updates
This commit is contained in:
+7
-4
@@ -45,11 +45,14 @@ wget https://storage.googleapis.com/ultralytics/yolov3/best_v1_0.pt -O weights/b
|
||||
|
||||
# Debug/Development
|
||||
sudo rm -rf yolov3
|
||||
# git clone https://github.com/ultralytics/yolov3 # master
|
||||
git clone -b map_update --depth 1 https://github.com/ultralytics/yolov3 yolov3 # branch
|
||||
git clone https://github.com/ultralytics/yolov3 # master
|
||||
# git clone -b hyperparameter_search --depth 1 https://github.com/ultralytics/yolov3 hyperparameter_search # branch
|
||||
cp -r weights yolov3
|
||||
cp -r cocoapi/PythonAPI/pycocotools yolov3
|
||||
cd yolov3
|
||||
|
||||
#git pull https://github.com/ultralytics/yolov3 map_update # branch
|
||||
python3 test.py --img-size 320
|
||||
git pull https://github.com/ultralytics/yolov3 #hyperparameter_search # branch
|
||||
python3 train.py --data-cfg data/coco_1cls.data
|
||||
python3 train.py --data-cfg data/coco_1img.data
|
||||
|
||||
|
||||
|
||||
+6
-6
@@ -295,12 +295,11 @@ def build_targets(model, targets):
|
||||
|
||||
txy, twh, tcls, indices = [], [], [], []
|
||||
for i, layer in enumerate(get_yolo_layers(model)):
|
||||
nG = model.module_list[layer][0].nG # grid size
|
||||
anchor_vec = model.module_list[layer][0].anchor_vec
|
||||
layer = model.module_list[layer][0]
|
||||
|
||||
# iou of targets-anchors
|
||||
gwh = targets[:, 4:6] * nG
|
||||
iou = [wh_iou(x, gwh) for x in anchor_vec]
|
||||
gwh = targets[:, 4:6] * layer.nG
|
||||
iou = [wh_iou(x, gwh) for x in layer.anchor_vec]
|
||||
iou, a = torch.stack(iou, 0).max(0) # best iou and anchor
|
||||
|
||||
# reject below threshold ious (OPTIONAL, increases P, lowers R)
|
||||
@@ -313,7 +312,7 @@ def build_targets(model, targets):
|
||||
|
||||
# Indices
|
||||
b, c = t[:, :2].long().t() # target image, class
|
||||
gxy = t[:, 2:4] * nG
|
||||
gxy = t[:, 2:4] * layer.nG
|
||||
gi, gj = gxy.long().t() # grid_i, grid_j
|
||||
indices.append((b, a, gj, gi))
|
||||
|
||||
@@ -321,11 +320,12 @@ def build_targets(model, targets):
|
||||
txy.append(gxy - gxy.floor())
|
||||
|
||||
# Width and height
|
||||
twh.append(torch.log(gwh / anchor_vec[a])) # yolo method
|
||||
twh.append(torch.log(gwh / layer.anchor_vec[a])) # yolo method
|
||||
# twh.append(torch.sqrt(gwh / anchor_vec[a]) / 2) # power method
|
||||
|
||||
# Class
|
||||
tcls.append(c)
|
||||
assert c.max() <= layer.nC, 'Target classes exceed model classes'
|
||||
|
||||
return txy, twh, tcls, indices
|
||||
|
||||
|
||||
Reference in New Issue
Block a user