updates
This commit is contained in:
parent
aa77cbea11
commit
3a0c16fbc2
|
@ -45,7 +45,10 @@ HS**V** Intensity | +/- 50%
|
||||||
|
|
||||||
# Inference
|
# 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")
|
![Alt](https://github.com/ultralytics/yolov3/blob/master/data/zidane_result.jpg "inference example")
|
||||||
|
|
||||||
|
|
3
train.py
3
train.py
|
@ -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.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(filter(lambda p: p.requires_grad, model.parameters()))
|
||||||
optimizer = torch.optim.Adam(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
|
start_epoch = checkpoint['epoch'] + 1
|
||||||
best_loss = checkpoint['best_loss']
|
best_loss = checkpoint['best_loss']
|
||||||
|
@ -79,6 +79,7 @@ def main(opt):
|
||||||
print('Using ', torch.cuda.device_count(), ' GPUs')
|
print('Using ', torch.cuda.device_count(), ' GPUs')
|
||||||
model = nn.DataParallel(model)
|
model = nn.DataParallel(model)
|
||||||
model.to(device).train()
|
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)
|
optimizer = torch.optim.Adam(filter(lambda p: p.requires_grad, model.parameters()), lr=1e-4, weight_decay=5e-4)
|
||||||
|
|
||||||
# Set scheduler
|
# Set scheduler
|
||||||
|
|
|
@ -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
|
sudo rm -rf yolov3 && git clone https://github.com/ultralytics/yolov3 && cd yolov3 && python3 train.py -img_size 416 -epochs 160
|
||||||
|
|
||||||
# Resume
|
# Resume
|
||||||
cd yolov3 && python3 train.py -img_size 416 -resume 1
|
python3 train.py -img_size 416 -resume 1
|
||||||
|
|
||||||
# Detect
|
# Detect
|
||||||
gsutil cp gs://ultralytics/fresh9_5_e201.pt yolov3/checkpoints
|
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
|
||||||
|
|
|
@ -367,11 +367,11 @@ def plotResults():
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
plt.figure(figsize=(16, 8))
|
plt.figure(figsize=(16, 8))
|
||||||
s = ['X', 'Y', 'Width', 'Height', 'Objectness', 'Classification', 'Total Loss', 'Precision', 'Recall']
|
s = ['X', 'Y', 'Width', 'Height', 'Objectness', 'Classification', 'Total Loss', 'Precision', 'Recall']
|
||||||
for f in ('/Users/glennjocher/Downloads/results.txt',
|
for f in ('/Users/glennjocher/Downloads/results_CE.txt',
|
||||||
'/Users/glennjocher/Downloads/resultsBCE.txt'):
|
'/Users/glennjocher/Downloads/results_BCE.txt'):
|
||||||
results = np.loadtxt(f, usecols=[2, 3, 4, 5, 6, 7, 8, 9, 10]).T
|
results = np.loadtxt(f, usecols=[2, 3, 4, 5, 6, 7, 8, 9, 10]).T
|
||||||
for i in range(9):
|
for i in range(9):
|
||||||
plt.subplot(2, 5, i + 1)
|
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.title(s[i])
|
||||||
plt.legend()
|
plt.legend
|
Loading…
Reference in New Issue