DRY conviences
make sure that autonaming works
datadump = "ipynb_tests/00_config_datadump"
extension = ".text"
Defaults.__hard_reset_test_dir__(datadump, keep_folder=True)
for i in range(3):
next_filename = Defaults._itername(pre = f"{datadump}/Defaults (",
post = f"){extension}")
with open(next_filename, "w") as outfile:
outfile.writelines("<data>")
for i in range(3):
next_filename = Defaults._itername(pre = f"{datadump}/Version - ",
post = "")
with open(next_filename, "w") as outfile:
outfile.writelines("<data>")
files = os.listdir(datadump)
assert len(files) == 6
files
Default Values are stored in "ModelAssistedLabel config.json"
Every time the class is called, the config file is re-read for changes.
Currently, the following attributes are then dynamically assigned to the newly-created Default
object.
- root (parent folder of YOLOv5 repo)
- resource_map (defines images as ".jpg" and labels as ".txt")
- split_ratio (by default, 70/20/10 split of train/valid/test.)
- data_yaml (from YOLOv5 repo)
- trainer template (from YOLOv5 repo)
This data is generated dynamically.
import json
d = Defaults()
data = d.read_json()
for k,v in data.items():
print("Attribute:", k, "\n\t- Type:", type(v))