Skip to content

Commit b18186e

Browse files
authored
✅ [Pass] tests, skip drawing if graphviz not found (#21)
Hi Ethan, Thank you for your contribution! Your changes look great, and I appreciate the addition of the condition to skip drawing if Graphviz is not found. This will definitely help in environments where Graphviz isn't available. I have reviewed the commit, and everything seems to be in order. All tests have passed as well, which is great. I'll go ahead and merge this PR. Thanks again for your efforts! Best regards, Henry Tsui
1 parent a0cddf7 commit b18186e

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

yolo/model/yolo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,5 +126,5 @@ def get_model(cfg: Config) -> YOLO:
126126
model = YOLO(cfg.model, cfg.hyper.data.class_num)
127127
logger.info("✅ Success load model")
128128
log_model_structure(model.model)
129-
# draw_model(model=model)
129+
draw_model(model=model)
130130
return model

yolo/tools/drawer.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ def draw_model(*, model_cfg=None, model=None, v7_base=False):
9595
for jdx in range(idx, model_size):
9696
if model_mat[idx, jdx]:
9797
dot.edge(str(idx), str(jdx))
98-
99-
dot.render("Model-arch", format="png", cleanup=True)
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")
100102
logger.info("🎨 Drawing Model Architecture at Model-arch.png")

0 commit comments

Comments
 (0)