π [Fix] Some display bug, enable print, log
Browse files- yolo/config/general.yaml +1 -1
- yolo/tools/solver.py +1 -0
- yolo/utils/bounding_box_utils.py +1 -1
- yolo/utils/solver_utils.py +8 -9
yolo/config/general.yaml
CHANGED
@@ -9,7 +9,7 @@ out_path: runs
|
|
9 |
exist_ok: True
|
10 |
|
11 |
lucky_number: 10
|
12 |
-
use_wandb:
|
13 |
use_TensorBoard: False
|
14 |
|
15 |
weight: True # Path to weight or True for auto, False for no pretrained weight
|
|
|
9 |
exist_ok: True
|
10 |
|
11 |
lucky_number: 10
|
12 |
+
use_wandb: False
|
13 |
use_TensorBoard: False
|
14 |
|
15 |
weight: True # Path to weight or True for auto, False for no pretrained weight
|
yolo/tools/solver.py
CHANGED
@@ -122,6 +122,7 @@ class ModelTrainer:
|
|
122 |
self.progress.finish_one_epoch(epoch_loss, epoch)
|
123 |
|
124 |
self.validator.solve(self.validation_dataloader, epoch_idx=epoch)
|
|
|
125 |
|
126 |
|
127 |
class ModelTester:
|
|
|
122 |
self.progress.finish_one_epoch(epoch_loss, epoch)
|
123 |
|
124 |
self.validator.solve(self.validation_dataloader, epoch_idx=epoch)
|
125 |
+
self.progress.finish_train()
|
126 |
|
127 |
|
128 |
class ModelTester:
|
yolo/utils/bounding_box_utils.py
CHANGED
@@ -268,7 +268,7 @@ class Vec2Box:
|
|
268 |
def __init__(self, model: YOLO, image_size, device):
|
269 |
self.device = device
|
270 |
|
271 |
-
if
|
272 |
logger.info(f"πΆ Found stride of model {model.strides}")
|
273 |
self.strides = model.strides
|
274 |
else:
|
|
|
268 |
def __init__(self, model: YOLO, image_size, device):
|
269 |
self.device = device
|
270 |
|
271 |
+
if hasattr(model, "strides"):
|
272 |
logger.info(f"πΆ Found stride of model {model.strides}")
|
273 |
self.strides = model.strides
|
274 |
else:
|
yolo/utils/solver_utils.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
import
|
2 |
-
import
|
3 |
|
4 |
from pycocotools.coco import COCO
|
5 |
from pycocotools.cocoeval import COCOeval
|
@@ -7,13 +7,12 @@ from rich.table import Table
|
|
7 |
|
8 |
|
9 |
def calculate_ap(coco_gt: COCO, pd_path):
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
sys.stdout = sys.__stdout__
|
17 |
return coco_eval.stats
|
18 |
|
19 |
|
|
|
1 |
+
import contextlib
|
2 |
+
import io
|
3 |
|
4 |
from pycocotools.coco import COCO
|
5 |
from pycocotools.cocoeval import COCOeval
|
|
|
7 |
|
8 |
|
9 |
def calculate_ap(coco_gt: COCO, pd_path):
|
10 |
+
with contextlib.redirect_stdout(io.StringIO()):
|
11 |
+
coco_dt = coco_gt.loadRes(pd_path)
|
12 |
+
coco_eval = COCOeval(coco_gt, coco_dt, "bbox")
|
13 |
+
coco_eval.evaluate()
|
14 |
+
coco_eval.accumulate()
|
15 |
+
coco_eval.summarize()
|
|
|
16 |
return coco_eval.stats
|
17 |
|
18 |
|