ποΈ [Add] type for logging model, capable for YOLO
Browse files
yolo/utils/logging_utils.py
CHANGED
@@ -16,7 +16,7 @@ import random
|
|
16 |
import sys
|
17 |
from collections import deque
|
18 |
from pathlib import Path
|
19 |
-
from typing import Any, Dict,
|
20 |
|
21 |
import numpy as np
|
22 |
import torch
|
@@ -34,9 +34,11 @@ from rich.progress import (
|
|
34 |
)
|
35 |
from rich.table import Table
|
36 |
from torch import Tensor
|
|
|
37 |
from torch.optim import Optimizer
|
38 |
|
39 |
from yolo.config.config import Config, YOLOLayer
|
|
|
40 |
from yolo.utils.solver_utils import make_ap_table
|
41 |
|
42 |
|
@@ -163,7 +165,9 @@ def custom_wandb_log(string="", level=int, newline=True, repeat=True, prefix=Tru
|
|
163 |
logger.opt(raw=not newline, colors=True).info("π " + line)
|
164 |
|
165 |
|
166 |
-
def log_model_structure(model:
|
|
|
|
|
167 |
console = Console()
|
168 |
table = Table(title="Model Layers")
|
169 |
|
|
|
16 |
import sys
|
17 |
from collections import deque
|
18 |
from pathlib import Path
|
19 |
+
from typing import Any, Dict, Union
|
20 |
|
21 |
import numpy as np
|
22 |
import torch
|
|
|
34 |
)
|
35 |
from rich.table import Table
|
36 |
from torch import Tensor
|
37 |
+
from torch.nn import ModuleList
|
38 |
from torch.optim import Optimizer
|
39 |
|
40 |
from yolo.config.config import Config, YOLOLayer
|
41 |
+
from yolo.model.yolo import YOLO
|
42 |
from yolo.utils.solver_utils import make_ap_table
|
43 |
|
44 |
|
|
|
165 |
logger.opt(raw=not newline, colors=True).info("π " + line)
|
166 |
|
167 |
|
168 |
+
def log_model_structure(model: Union[ModuleList, YOLOLayer, YOLO]):
|
169 |
+
if isinstance(model, YOLO):
|
170 |
+
model = model.model
|
171 |
console = Console()
|
172 |
table = Table(title="Model Layers")
|
173 |
|