This commit is contained in:
Glenn Jocher 2018-09-04 14:36:51 +02:00
parent aa77cbea11
commit 3a0c16fbc2
4 changed files with 14 additions and 8 deletions

View File

@ -45,7 +45,10 @@ HS**V** Intensity | +/- 50%
# Inference
Checkpoints are saved in `/checkpoints` directory. Run `detect.py` to apply trained weights to an image, such as `zidane.jpg` from the `data/samples` folder, shown here.
Checkpoints are saved in `/checkpoints` directory. Run `detect.py` to apply trained weights to an image, such as `zidane.jpg` from the `data/samples` folder, shown here. Alternatively you can use the official YOLOv3 weights:
-PyTorch format: https://storage.googleapis.com/ultralytics/yolov3.pt
-darknet format: https://pjreddie.com/media/files/yolov3.weights
![Alt](https://github.com/ultralytics/yolov3/blob/master/data/zidane_result.jpg "inference example")

View File

@ -68,7 +68,7 @@ def main(opt):
# optimizer = torch.optim.SGD(model.parameters(), lr=.001, momentum=.9, weight_decay=5e-4, nesterov=True)
# optimizer = torch.optim.Adam(filter(lambda p: p.requires_grad, model.parameters()))
optimizer = torch.optim.Adam(model.parameters())
optimizer.load_state_dict(checkpoint['optimizer'])
#optimizer.load_state_dict(checkpoint['optimizer'])
start_epoch = checkpoint['epoch'] + 1
best_loss = checkpoint['best_loss']
@ -79,6 +79,7 @@ def main(opt):
print('Using ', torch.cuda.device_count(), ' GPUs')
model = nn.DataParallel(model)
model.to(device).train()
# optimizer = torch.optim.SGD(model.parameters(), lr=1e-4, momentum=.9, weight_decay=5e-4)
optimizer = torch.optim.Adam(filter(lambda p: p.requires_grad, model.parameters()), lr=1e-4, weight_decay=5e-4)
# Set scheduler

View File

@ -4,9 +4,11 @@
sudo rm -rf yolov3 && git clone https://github.com/ultralytics/yolov3 && cd yolov3 && python3 train.py -img_size 416 -epochs 160
# Resume
cd yolov3 && python3 train.py -img_size 416 -resume 1
python3 train.py -img_size 416 -resume 1
# Detect
gsutil cp gs://ultralytics/fresh9_5_e201.pt yolov3/checkpoints
cd yolov3 && python3 detect.py
python3 detect.py
# Test
python3 test.py -img_size 416 -weights_path checkpoints/latest.pt

View File

@ -367,11 +367,11 @@ def plotResults():
import matplotlib.pyplot as plt
plt.figure(figsize=(16, 8))
s = ['X', 'Y', 'Width', 'Height', 'Objectness', 'Classification', 'Total Loss', 'Precision', 'Recall']
for f in ('/Users/glennjocher/Downloads/results.txt',
'/Users/glennjocher/Downloads/resultsBCE.txt'):
for f in ('/Users/glennjocher/Downloads/results_CE.txt',
'/Users/glennjocher/Downloads/results_BCE.txt'):
results = np.loadtxt(f, usecols=[2, 3, 4, 5, 6, 7, 8, 9, 10]).T
for i in range(9):
plt.subplot(2, 5, i + 1)
plt.plot(results[i, :], marker='.', label=f)
plt.plot(results[i, :19], marker='.', label=f)
plt.title(s[i])
plt.legend()
plt.legend