Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
7f953b2106
|
@ -16,7 +16,7 @@ jobs:
|
||||||
<a href="https://apps.apple.com/app/id1452689527" target="_blank">
|
<a href="https://apps.apple.com/app/id1452689527" target="_blank">
|
||||||
<img src="https://user-images.githubusercontent.com/26833433/82944393-f7644d80-9f4f-11ea-8b87-1a5b04f555f1.jpg" width="800"></a>
|
<img src="https://user-images.githubusercontent.com/26833433/82944393-f7644d80-9f4f-11ea-8b87-1a5b04f555f1.jpg" width="800"></a>
|
||||||
|
|
||||||
<img src="https://user-images.githubusercontent.com/26833433/84200349-729f2680-aa5b-11ea-8f9a-604c9e01a658.png" width="800">
|
<img src="https://user-images.githubusercontent.com/26833433/85340570-30360a80-b49b-11ea-87cf-bdf33d53ae15.png" width="800">
|
||||||
|
|
||||||
To continue with this repo, please visit our [Custom Training Tutorial](https://github.com/ultralytics/yolov3/wiki/Train-Custom-Data) to get started, and see our [Google Colab Notebook](https://github.com/ultralytics/yolov3/blob/master/tutorial.ipynb), [Docker Image](https://hub.docker.com/r/ultralytics/yolov3), and [GCP Quickstart Guide](https://github.com/ultralytics/yolov3/wiki/GCP-Quickstart) for example environments.
|
To continue with this repo, please visit our [Custom Training Tutorial](https://github.com/ultralytics/yolov3/wiki/Train-Custom-Data) to get started, and see our [Google Colab Notebook](https://github.com/ultralytics/yolov3/blob/master/tutorial.ipynb), [Docker Image](https://hub.docker.com/r/ultralytics/yolov3), and [GCP Quickstart Guide](https://github.com/ultralytics/yolov3/wiki/GCP-Quickstart) for example environments.
|
||||||
|
|
||||||
|
|
|
@ -438,7 +438,7 @@ def convert(cfg='cfg/yolov3-spp.cfg', weights='weights/yolov3-spp.weights'):
|
||||||
|
|
||||||
target = weights.rsplit('.', 1)[0] + '.pt'
|
target = weights.rsplit('.', 1)[0] + '.pt'
|
||||||
torch.save(chkpt, target)
|
torch.save(chkpt, target)
|
||||||
print("Success: converted '%s' to 's%'" % (weights, target))
|
print("Success: converted '%s' to '%s'" % (weights, target))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print('Error: extension not supported.')
|
print('Error: extension not supported.')
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
numpy == 1.17
|
numpy == 1.17
|
||||||
opencv-python >= 4.1
|
opencv-python >= 4.1
|
||||||
torch >= 1.5
|
torch >= 1.5
|
||||||
|
torchvision
|
||||||
matplotlib
|
matplotlib
|
||||||
pycocotools
|
pycocotools
|
||||||
tqdm
|
tqdm
|
||||||
|
|
10
train.py
10
train.py
|
@ -144,6 +144,15 @@ def train(hyp):
|
||||||
# possible weights are '*.weights', 'yolov3-tiny.conv.15', 'darknet53.conv.74' etc.
|
# possible weights are '*.weights', 'yolov3-tiny.conv.15', 'darknet53.conv.74' etc.
|
||||||
load_darknet_weights(model, weights)
|
load_darknet_weights(model, weights)
|
||||||
|
|
||||||
|
if opt.freeze_layers:
|
||||||
|
output_layer_indices = [idx - 1 for idx, module in enumerate(model.module_list) if isinstance(module, YOLOLayer)]
|
||||||
|
freeze_layer_indices = [x for x in range(len(model.module_list)) if
|
||||||
|
(x not in output_layer_indices) and
|
||||||
|
(x - 1 not in output_layer_indices)]
|
||||||
|
for idx in freeze_layer_indices:
|
||||||
|
for parameter in model.module_list[idx].parameters():
|
||||||
|
parameter.requires_grad_(False)
|
||||||
|
|
||||||
# Mixed precision training https://github.com/NVIDIA/apex
|
# Mixed precision training https://github.com/NVIDIA/apex
|
||||||
if mixed_precision:
|
if mixed_precision:
|
||||||
model, optimizer = amp.initialize(model, optimizer, opt_level='O1', verbosity=0)
|
model, optimizer = amp.initialize(model, optimizer, opt_level='O1', verbosity=0)
|
||||||
|
@ -394,6 +403,7 @@ if __name__ == '__main__':
|
||||||
parser.add_argument('--device', default='', help='device id (i.e. 0 or 0,1 or cpu)')
|
parser.add_argument('--device', default='', help='device id (i.e. 0 or 0,1 or cpu)')
|
||||||
parser.add_argument('--adam', action='store_true', help='use adam optimizer')
|
parser.add_argument('--adam', action='store_true', help='use adam optimizer')
|
||||||
parser.add_argument('--single-cls', action='store_true', help='train as single-class dataset')
|
parser.add_argument('--single-cls', action='store_true', help='train as single-class dataset')
|
||||||
|
parser.add_argument('--freeze-layers', action='store_true', help='Freeze non-output layers')
|
||||||
opt = parser.parse_args()
|
opt = parser.parse_args()
|
||||||
opt.weights = last if opt.resume else opt.weights
|
opt.weights = last if opt.resume else opt.weights
|
||||||
check_git_status()
|
check_git_status()
|
||||||
|
|
Loading…
Reference in New Issue