forked from ultralytics/yolov5
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pycocotools best.pt after COCO train (ultralytics#1616)
* Pycocotools best.pt after COCO train * cleanup
- Loading branch information
1 parent
d929bb6
commit 791dadb
Showing
5 changed files
with
117 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# parameters | ||
nc: 80 # number of classes | ||
depth_multiple: 1.0 # model depth multiple | ||
width_multiple: 1.0 # layer channel multiple | ||
|
||
# anchors | ||
anchors: | ||
- [10,14, 23,27, 37,58] # P4/16 | ||
- [81,82, 135,169, 344,319] # P5/32 | ||
|
||
# YOLOv3-tiny backbone | ||
backbone: | ||
# [from, number, module, args] | ||
[[-1, 1, Conv, [16, 3, 1]], # 0 | ||
[-1, 1, nn.MaxPool2d, [2, 2, 0]], # 1-P1/2 | ||
[-1, 1, Conv, [32, 3, 1]], | ||
[-1, 1, nn.MaxPool2d, [2, 2, 0]], # 3-P2/4 | ||
[-1, 1, Conv, [64, 3, 1]], | ||
[-1, 1, nn.MaxPool2d, [2, 2, 0]], # 5-P3/8 | ||
[-1, 1, Conv, [128, 3, 1]], | ||
[-1, 1, nn.MaxPool2d, [2, 2, 0]], # 7-P4/16 | ||
[-1, 1, Conv, [256, 3, 1]], | ||
[-1, 1, nn.MaxPool2d, [2, 2, 0]], # 9-P5/32 | ||
[-1, 1, Conv, [512, 3, 1]], | ||
[-1, 1, nn.ZeroPad2d, [0, 1, 0, 1]], # 11 | ||
[-1, 1, nn.MaxPool2d, [2, 1, 0]], # 12 | ||
] | ||
|
||
# YOLOv3-tiny head | ||
head: | ||
[[-1, 1, Conv, [1024, 3, 1]], | ||
[-1, 1, Conv, [256, 1, 1]], | ||
[-1, 1, Conv, [512, 3, 1]], # 15 (P5/32-large) | ||
|
||
[-2, 1, Conv, [128, 1, 1]], | ||
[-1, 1, nn.Upsample, [None, 2, 'nearest']], | ||
[[-1, 8], 1, Concat, [1]], # cat backbone P4 | ||
[-1, 1, Conv, [256, 3, 1]], # 19 (P4/16-medium) | ||
|
||
[[19, 15], 1, Detect, [nc, anchors]], # Detect(P4, P5) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# parameters | ||
nc: 80 # number of classes | ||
depth_multiple: 1.0 # model depth multiple | ||
width_multiple: 1.0 # layer channel multiple | ||
|
||
# anchors | ||
anchors: | ||
- [10,13, 16,30, 33,23] # P3/8 | ||
- [30,61, 62,45, 59,119] # P4/16 | ||
- [116,90, 156,198, 373,326] # P5/32 | ||
|
||
# darknet53 backbone | ||
backbone: | ||
# [from, number, module, args] | ||
[[-1, 1, Conv, [32, 3, 1]], # 0 | ||
[-1, 1, Conv, [64, 3, 2]], # 1-P1/2 | ||
[-1, 1, Bottleneck, [64]], | ||
[-1, 1, Conv, [128, 3, 2]], # 3-P2/4 | ||
[-1, 2, Bottleneck, [128]], | ||
[-1, 1, Conv, [256, 3, 2]], # 5-P3/8 | ||
[-1, 8, Bottleneck, [256]], | ||
[-1, 1, Conv, [512, 3, 2]], # 7-P4/16 | ||
[-1, 8, Bottleneck, [512]], | ||
[-1, 1, Conv, [1024, 3, 2]], # 9-P5/32 | ||
[-1, 4, Bottleneck, [1024]], # 10 | ||
] | ||
|
||
# YOLOv3 head | ||
head: | ||
[[-1, 1, Bottleneck, [1024, False]], | ||
[-1, 1, Conv, [512, [1, 1]]], | ||
[-1, 1, Conv, [1024, 3, 1]], | ||
[-1, 1, Conv, [512, 1, 1]], | ||
[-1, 1, Conv, [1024, 3, 1]], # 15 (P5/32-large) | ||
|
||
[-2, 1, Conv, [256, 1, 1]], | ||
[-1, 1, nn.Upsample, [None, 2, 'nearest']], | ||
[[-1, 8], 1, Concat, [1]], # cat backbone P4 | ||
[-1, 1, Bottleneck, [512, False]], | ||
[-1, 1, Bottleneck, [512, False]], | ||
[-1, 1, Conv, [256, 1, 1]], | ||
[-1, 1, Conv, [512, 3, 1]], # 22 (P4/16-medium) | ||
|
||
[-2, 1, Conv, [128, 1, 1]], | ||
[-1, 1, nn.Upsample, [None, 2, 'nearest']], | ||
[[-1, 6], 1, Concat, [1]], # cat backbone P3 | ||
[-1, 1, Bottleneck, [256, False]], | ||
[-1, 2, Bottleneck, [256, False]], # 27 (P3/8-small) | ||
|
||
[[27, 22, 15], 1, Detect, [nc, anchors]], # Detect(P3, P4, P5) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import argparse | ||
import glob | ||
import json | ||
import os | ||
from pathlib import Path | ||
|
@@ -246,7 +245,7 @@ def test(data, | |
# Save JSON | ||
if save_json and len(jdict): | ||
w = Path(weights[0] if isinstance(weights, list) else weights).stem if weights is not None else '' # weights | ||
anno_json = glob.glob('../coco/annotations/instances_val*.json')[0] # annotations json | ||
anno_json = '../coco/annotations/instances_val2017.json' # annotations json | ||
pred_json = str(save_dir / f"{w}_predictions.json") # predictions json | ||
print('\nEvaluating pycocotools mAP... saving %s...' % pred_json) | ||
with open(pred_json, 'w') as f: | ||
|
@@ -266,7 +265,7 @@ def test(data, | |
eval.summarize() | ||
map, map50 = eval.stats[:2] # update results ([email protected]:0.95, [email protected]) | ||
except Exception as e: | ||
print('ERROR: pycocotools unable to run: %s' % e) | ||
print(f'pycocotools unable to run: {e}') | ||
|
||
# Return results | ||
if not training: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters