This commit is contained in:
Glenn Jocher 2019-04-11 12:47:35 +02:00
parent cbd5347cc3
commit e6e6fb6f57
3 changed files with 6 additions and 5 deletions

View File

@ -176,7 +176,7 @@ def test(
if __name__ == '__main__': if __name__ == '__main__':
parser = argparse.ArgumentParser(prog='test.py') parser = argparse.ArgumentParser(prog='test.py')
parser.add_argument('--batch-size', type=int, default=32, help='size of each image batch') parser.add_argument('--batch-size', type=int, default=3, help='size of each image batch')
parser.add_argument('--cfg', type=str, default='cfg/yolov3-spp.cfg', help='cfg file path') parser.add_argument('--cfg', type=str, default='cfg/yolov3-spp.cfg', help='cfg file path')
parser.add_argument('--data-cfg', type=str, default='data/coco.data', help='coco.data file path') parser.add_argument('--data-cfg', type=str, default='data/coco.data', help='coco.data file path')
parser.add_argument('--weights', type=str, default='weights/yolov3-spp.weights', help='path to weights file') parser.add_argument('--weights', type=str, default='weights/yolov3-spp.weights', help='path to weights file')

View File

@ -10,8 +10,8 @@ sudo reboot now
# Re-clone # Re-clone
sudo rm -rf yolov3 sudo rm -rf yolov3
# git clone https://github.com/ultralytics/yolov3 # master git clone https://github.com/ultralytics/yolov3 # master
git clone -b test --depth 1 https://github.com/ultralytics/yolov3 yolov3_test # branch # git clone -b test --depth 1 https://github.com/ultralytics/yolov3 yolov3_test # branch
cp -r weights yolov3 cp -r weights yolov3
cp -r cocoapi/PythonAPI/pycocotools yolov3 cp -r cocoapi/PythonAPI/pycocotools yolov3
cd yolov3 cd yolov3
@ -50,6 +50,7 @@ git clone https://github.com/ultralytics/yolov3 # master
cp -r weights yolov3 cp -r weights yolov3
cp -r cocoapi/PythonAPI/pycocotools yolov3 cp -r cocoapi/PythonAPI/pycocotools yolov3
cd yolov3 cd yolov3
python3 test.py --save-json
git pull https://github.com/ultralytics/yolov3 git pull https://github.com/ultralytics/yolov3
python3 train.py --data-cfg data/coco_1img.data python3 train.py --data-cfg data/coco_1img.data

View File

@ -284,7 +284,7 @@ def compute_loss(p, targets): # predictions, targets
def build_targets(model, targets): def build_targets(model, targets):
# targets = [image, class, x, y, w, h] # targets = [image, class, x, y, w, h]
if isinstance(model, nn.parallel.DistributedDataParallel): if type(model) in (nn.parallel.DataParallel, nn.parallel.DistributedDataParallel):
model = model.module model = model.module
txy, twh, tcls, indices = [], [], [], [] txy, twh, tcls, indices = [], [], [], []
@ -523,7 +523,7 @@ def plot_results(start=0, stop=0): # from utils.utils import *; plot_results()
x = range(start, min(stop, n) if stop else n) x = range(start, min(stop, n) if stop else n)
for i in range(10): for i in range(10):
plt.subplot(2, 5, i + 1) plt.subplot(2, 5, i + 1)
plt.plot(x, results[i, x].clip(max=500), marker='.', label=f.replace('.txt','')) plt.plot(x, results[i, x].clip(max=500), marker='.', label=f.replace('.txt', ''))
plt.title(s[i]) plt.title(s[i])
if i == 0: if i == 0:
plt.legend() plt.legend()