merge with master

pull/5417/head
Stefano Sinigardi 5 years ago
commit a3f6c2b58e
  1. 2
      README.md
  2. 7
      build/darknet/x64/cfg/yolov4.cfg
  3. 4
      build/darknet/x64/darknet.py
  4. 4
      build/darknet/x64/darknet_video.py
  5. 7
      cfg/yolov4.cfg
  6. 4
      darknet.py
  7. 4
      darknet_video.py
  8. 2
      src/activations.c

@ -389,7 +389,7 @@ Then add to your created project:
2. Then stop and by using partially-trained model `/backup/yolov4_1000.weights` run training with multigpu (up to 4 GPUs): `darknet.exe detector train cfg/coco.data cfg/yolov4.cfg /backup/yolov4_1000.weights -gpus 0,1,2,3`
Only for small datasets sometimes better to decrease learning rate, for 4 GPUs set `learning_rate = 0.00025` (i.e. learning_rate = 0.001 / GPUs). In this case also increase 4x times `burn_in =` and `max_batches =` in your cfg-file. I.e. use `burn_in = 4000` instead of `1000`. Same goes for `steps=` if `policy=steps` is set.
If you get a Nan, then for some datasets better to decrease learning rate, for 4 GPUs set `learning_rate = 0,00065` (i.e. learning_rate = 0.00261 / GPUs). In this case also increase 4x times `burn_in =` in your cfg-file. I.e. use `burn_in = 4000` instead of `1000`.
https://groups.google.com/d/msg/darknet/NbJqonJBTSY/Te5PfIpuCAAJ

@ -1,10 +1,9 @@
[net]
# Testing
#batch=1
#subdivisions=1
# Training
batch=64
subdivisions=8
# Training
#width=512
#height=512
width=608
height=608
channels=3

@ -313,7 +313,7 @@ netMain = None
metaMain = None
altNames = None
def performDetect(imagePath="data/dog.jpg", thresh= 0.25, configPath = "./cfg/yolov3.cfg", weightPath = "yolov3.weights", metaPath= "./cfg/coco.data", showImage= True, makeImageOnly = False, initOnly= False):
def performDetect(imagePath="data/dog.jpg", thresh= 0.25, configPath = "./cfg/yolov4.cfg", weightPath = "yolov4.weights", metaPath= "./cfg/coco.data", showImage= True, makeImageOnly = False, initOnly= False):
"""
Convenience function to handle the detection and returns of objects.
@ -456,7 +456,7 @@ def performDetect(imagePath="data/dog.jpg", thresh= 0.25, configPath = "./cfg/yo
print("Unable to show image: "+str(e))
return detections
def performBatchDetect(thresh= 0.25, configPath = "./cfg/yolov3.cfg", weightPath = "yolov3.weights", metaPath= "./cfg/coco.data", hier_thresh=.5, nms=.45, batch_size=3):
def performBatchDetect(thresh= 0.25, configPath = "./cfg/yolov4.cfg", weightPath = "yolov4.weights", metaPath= "./cfg/coco.data", hier_thresh=.5, nms=.45, batch_size=3):
import cv2
import numpy as np
# NB! Image sizes should be the same

@ -42,8 +42,8 @@ altNames = None
def YOLO():
global metaMain, netMain, altNames
configPath = "./cfg/yolov3.cfg"
weightPath = "./yolov3.weights"
configPath = "./cfg/yolov4.cfg"
weightPath = "./yolov4.weights"
metaPath = "./cfg/coco.data"
if not os.path.exists(configPath):
raise ValueError("Invalid config path `" +

@ -1,10 +1,9 @@
[net]
# Testing
#batch=1
#subdivisions=1
# Training
batch=64
subdivisions=8
# Training
#width=512
#height=512
width=608
height=608
channels=3

@ -313,7 +313,7 @@ netMain = None
metaMain = None
altNames = None
def performDetect(imagePath="data/dog.jpg", thresh= 0.25, configPath = "./cfg/yolov3.cfg", weightPath = "yolov3.weights", metaPath= "./cfg/coco.data", showImage= True, makeImageOnly = False, initOnly= False):
def performDetect(imagePath="data/dog.jpg", thresh= 0.25, configPath = "./cfg/yolov4.cfg", weightPath = "yolov4.weights", metaPath= "./cfg/coco.data", showImage= True, makeImageOnly = False, initOnly= False):
"""
Convenience function to handle the detection and returns of objects.
@ -456,7 +456,7 @@ def performDetect(imagePath="data/dog.jpg", thresh= 0.25, configPath = "./cfg/yo
print("Unable to show image: "+str(e))
return detections
def performBatchDetect(thresh= 0.25, configPath = "./cfg/yolov3.cfg", weightPath = "yolov3.weights", metaPath= "./cfg/coco.data", hier_thresh=.5, nms=.45, batch_size=3):
def performBatchDetect(thresh= 0.25, configPath = "./cfg/yolov4.cfg", weightPath = "yolov4.weights", metaPath= "./cfg/coco.data", hier_thresh=.5, nms=.45, batch_size=3):
import cv2
import numpy as np
# NB! Image sizes should be the same

@ -42,8 +42,8 @@ altNames = None
def YOLO():
global metaMain, netMain, altNames
configPath = "./cfg/yolov3.cfg"
weightPath = "./yolov3.weights"
configPath = "./cfg/yolov4.cfg"
weightPath = "./yolov4.weights"
metaPath = "./cfg/coco.data"
if not os.path.exists(configPath):
raise ValueError("Invalid config path `" +

@ -293,6 +293,8 @@ float gradient(float x, ACTIVATION a)
return loggy_gradient(x);
case RELU:
return relu_gradient(x);
case RELU6:
return relu6_gradient(x);
case NORM_CHAN:
//return relu_gradient(x);
case NORM_CHAN_SOFTMAX_MAXVAL:

Loading…
Cancel
Save