فهرست منبع

release YOLOF-R18

yjh0410 1 سال پیش
والد
کامیت
1f595ed921
4فایلهای تغییر یافته به همراه20 افزوده شده و 49 حذف شده
  1. 5 25
      odlab/models/detectors/fcos/README.md
  2. 3 20
      odlab/models/detectors/yolof/README.md
  3. 5 1
      odlab/models/detectors/yolof/yolof.py
  4. 7 3
      odlab/test.py

+ 5 - 25
odlab/models/detectors/fcos/README.md

@@ -1,34 +1,14 @@
 # FCOS: Fully Convolutional One-Stage Object Detector
 
-Our `FCOS-R50-1x` baseline on COCO-val:
-```Shell
- Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.391
- Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.579
- Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.422
- Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.236
- Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.428
- Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.501
- Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.326
- Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.559
- Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.625
- Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.450
- Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.685
- Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.758
-```
-
-- FCOS
-
-| Model        |  scale     |  FPS  | AP<sup>val<br>0.5:0.95 | AP<sup>val<br>0.5 | Weight | Logs  |
-| -------------| ---------- | ----- | ---------------------- |  ---------------  | ------ | ----- |
-| FCOS_R18_1x  |  800,1333  |       |          34.1          |        52.2       | [ckpt](https://github.com/yjh0410/ODLab/releases/download/detection_weights/fcos_r18_1x_coco.pth) | [Logs](https://github.com/yjh0410/ODLab/releases/download/detection_weights/FCOS-R18-1x.txt) |
-| FCOS_R50_1x  |  800,1333  |       |          39.1          |        57.9       | [ckpt](https://github.com/yjh0410/ODLab/releases/download/detection_weights/fcos_r50_1x_coco.pth) | [Logs](https://github.com/yjh0410/ODLab/releases/download/detection_weights/FCOS-R50-1x.txt) |
 
-- Real-time FCOS
+- COCO
 
 | Model          |  scale     |  FPS  | AP<sup>val<br>0.5:0.95 | AP<sup>val<br>0.5 | Weight | Logs  |
 | ---------------| ---------- | ----- | ---------------------- |  ---------------  | ------ | ----- |
-| FCOS_RT_R18_4x |  512,736   |       |                        |                   |        |  |
-| FCOS_RT_R50_4x |  512,736   |       |          43.9          |        60.2       |        |  |
+| FCOS_R18_1x    |  800,1333  |       |                    |               | [ckpt]() | [Logs]() |
+| FCOS_R50_1x    |  800,1333  |       |                        |                   | [ckpt]() | [Logs]() |
+| FCOS_RT_R18_4x |  512,736   |       |                        |                   | [ckpt]() | [Logs]() |
+| FCOS_RT_R50_4x |  512,736   |       |                        |                   | [ckpt]() | [Logs]() |
 
 ## Train FCOS
 ### Single GPU

+ 3 - 20
odlab/models/detectors/yolof/README.md

@@ -1,28 +1,11 @@
 # YOLOF: You Only Look One-level Feature
 
-Our `YOLOF-R50-1x` baseline on COCO-val:
-```Shell
- Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.380
- Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.577
- Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.405
- Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.199
- Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.425
- Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.523
- Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.315
- Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.513
- Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.555
- Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.333
- Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.628
- Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.736
-```
-
-- ImageNet-1K_V1 pretrained
+- COCO
 
 | Model            |  scale     |  FPS  | AP<sup>val<br>0.5:0.95 | AP<sup>val<br>0.5 | Weight | Logs  |
 | ---------------- | ---------- | ----- | ---------------------- |  ---------------  | ------ | ----- |
-| YOLOF_R18_C5_1x  |  800,1333  |       |          32.8          |       51.2        | [ckpt](https://github.com/yjh0410/ODLab/releases/download/detection_weights/yolof_r18_c5_1x_coco.pth) | [log](https://github.com/yjh0410/ODLab/releases/download/detection_weights/YOLOF-R18-C5-1x.txt) |
-| YOLOF_R50_C5_1x  |  800,1333  |       |          38.0          |       57.7        | [ckpt](https://github.com/yjh0410/ODLab/releases/download/detection_weights/yolof_r50_c5_1x_coco.pth) | [log](https://github.com/yjh0410/ODLab/releases/download/detection_weights/YOLOF-R50-C5-1x.txt) |
-| YOLOF_R50_DC5_1x |  800,1333  |       |          39.5          |       58.5        | [ckpt](https://github.com/yjh0410/ODLab/releases/download/detection_weights/yolof_r50_dc5_1x_coco.pth) | [log](https://github.com/yjh0410/ODLab/releases/download/detection_weights/YOLOF-R50-DC5-1x.txt) |
+| YOLOF_R18_C5_1x  |  800,1333  |       |          32.8          |       51.4        | [ckpt](https://github.com/yjh0410/YOLO-Tutorial-v2/releases/download/yolo_tutorial_ckpt/yolof_r18_c5_1x_coco.pth) | [log](https://github.com/yjh0410/YOLO-Tutorial-v2/releases/download/yolo_tutorial_ckpt/YOLOF-R18-C5-1x.txt) |
+| YOLOF_R50_C5_1x  |  800,1333  |       |                        |                   |  |  |
 
 
 ## Train YOLOF

+ 5 - 1
odlab/models/detectors/yolof/yolof.py

@@ -101,6 +101,10 @@ class YOLOF(nn.Module):
             bboxes[..., 1::2] /= src.shape[-2]
             bboxes = bboxes.clip(0., 1.)
 
-            return bboxes, scores, labels
+            outputs = {
+                'scores': scores,
+                'labels': labels,
+                'bboxes': bboxes
+            }
 
         return outputs 

+ 7 - 3
odlab/test.py

@@ -73,7 +73,11 @@ def test_det(args, model, device, dataset, transform, class_colors, class_names)
         bboxes[..., 0::2] *= orig_w
         bboxes[..., 1::2] *= orig_h
 
-        # vis detection
+        # Convert PIL.Image to numpy
+        image = np.array(image).astype(np.uint8)
+        image = image[..., (2, 1, 0)].copy()
+
+        # Visualize results
         img_processed = visualize(image=image,
                                   bboxes=bboxes,
                                   scores=scores,
@@ -127,8 +131,8 @@ if __name__ == '__main__':
     model_copy.eval()
     compute_flops(
         model=model_copy,
-        min_size=cfg['test_min_size'],
-        max_size=cfg['test_max_size'],
+        min_size=cfg.test_min_size,
+        max_size=cfg.test_max_size,
         device=device)
     del model_copy