π [Merge] branch 'main' into INFERENCE
Browse files- yolo/model/yolo.py +1 -1
- yolo/tools/dataset_preparation.py +2 -2
- yolo/tools/drawer.py +4 -2
yolo/model/yolo.py
CHANGED
|
@@ -126,5 +126,5 @@ def get_model(cfg: Config) -> YOLO:
|
|
| 126 |
model = YOLO(cfg.model, cfg.hyper.data.class_num)
|
| 127 |
logger.info("β
Success load model")
|
| 128 |
log_model_structure(model.model)
|
| 129 |
-
|
| 130 |
return model
|
|
|
|
| 126 |
model = YOLO(cfg.model, cfg.hyper.data.class_num)
|
| 127 |
logger.info("β
Success load model")
|
| 128 |
log_model_structure(model.model)
|
| 129 |
+
draw_model(model=model)
|
| 130 |
return model
|
yolo/tools/dataset_preparation.py
CHANGED
|
@@ -61,7 +61,7 @@ def prepare_dataset(cfg):
|
|
| 61 |
extract_to = os.path.join(data_dir, data_type) if data_type != "annotations" else data_dir
|
| 62 |
final_place = os.path.join(extract_to, dataset_type)
|
| 63 |
|
| 64 |
-
os.makedirs(
|
| 65 |
if check_files(final_place, dataset_args.get("file_num")):
|
| 66 |
logger.info(f"β
Dataset {dataset_type: <12} already verified.")
|
| 67 |
continue
|
|
@@ -78,7 +78,7 @@ if __name__ == "__main__":
|
|
| 78 |
import sys
|
| 79 |
|
| 80 |
sys.path.append("./")
|
| 81 |
-
from
|
| 82 |
|
| 83 |
custom_logger()
|
| 84 |
prepare_dataset()
|
|
|
|
| 61 |
extract_to = os.path.join(data_dir, data_type) if data_type != "annotations" else data_dir
|
| 62 |
final_place = os.path.join(extract_to, dataset_type)
|
| 63 |
|
| 64 |
+
os.makedirs(final_place, exist_ok=True)
|
| 65 |
if check_files(final_place, dataset_args.get("file_num")):
|
| 66 |
logger.info(f"β
Dataset {dataset_type: <12} already verified.")
|
| 67 |
continue
|
|
|
|
| 78 |
import sys
|
| 79 |
|
| 80 |
sys.path.append("./")
|
| 81 |
+
from utils.logging_utils import custom_logger
|
| 82 |
|
| 83 |
custom_logger()
|
| 84 |
prepare_dataset()
|
yolo/tools/drawer.py
CHANGED
|
@@ -95,6 +95,8 @@ def draw_model(*, model_cfg=None, model=None, v7_base=False):
|
|
| 95 |
for jdx in range(idx, model_size):
|
| 96 |
if model_mat[idx, jdx]:
|
| 97 |
dot.edge(str(idx), str(jdx))
|
| 98 |
-
|
| 99 |
-
|
|
|
|
|
|
|
| 100 |
logger.info("π¨ Drawing Model Architecture at Model-arch.png")
|
|
|
|
| 95 |
for jdx in range(idx, model_size):
|
| 96 |
if model_mat[idx, jdx]:
|
| 97 |
dot.edge(str(idx), str(jdx))
|
| 98 |
+
try:
|
| 99 |
+
dot.render("Model-arch", format="png", cleanup=True)
|
| 100 |
+
except:
|
| 101 |
+
logger.info("Warning: Could not find graphviz backend, continue without drawing the model architecture")
|
| 102 |
logger.info("π¨ Drawing Model Architecture at Model-arch.png")
|