Open Witek- opened 4 years ago
Thanks for your quick reply. I use my own dataset of city birds, which is probably far from perfect. It may have some incorrect labels or missed objects (especially if they are quite small).
Yes, I do use separate training and validation sets. I understand why there might be a limit to accuracy, but what about the loss plot - is it normal that it differs so much for two networks and exactly the same data?
I will see what happens for 608x608 as I trained v3 at this resolution. It's worth noting that the results were slightly worse than for 416x416. So it must be the dataset I guess. I wonder what the loss function is going to look like? Well, I just startedtreining and it says...146 hours....
Accuracy is important, loss is not important.
The absolute value of the loss is not important at all. It is important is loss decreasing or not, i.e. derivative of loss is important.
Your dataset just isn't representative. https://github.com/AlexeyAB/darknet#how-to-improve-object-detection
for each object which you want to detect - there must be at least 1 similar object in the Training dataset with about the same: shape, side of object, relative size, angle of rotation, tilt, illumination. So desirable that your training dataset include images with objects at diffrent: scales, rotations, lightings, from different sides, on different backgrounds - you should preferably have 2000 different images for each class or more, and you should train 2000*classes iterations or more
I guess you are right. So is it correct to say that generally Yolov4 loss values are higher that for Yolov3 as they are simply formualted in a slightly different way?
Yes.
GIoU, CIoU, DIoU
and IT: IoU threshold - using multiple anchors for a single ground truth IoU (truth, anchor) > IoU threshold
increase Loss (and deltas).
Thank you for clarification.
Hi,
I trained both versions of Yolo on a dataset of my own (10 classes, around 300 training samples per class plus around 3000 "other" images) and the loss plot seems strange. I used default settings for both networks except for the subdivisions (16 for v3 and 32 for v4). Of course, I adjusted filters and classes accordingly. Or did I forget something with Yolov4?
Here is the plot for Yolov3:![chart](https://user-images.githubusercontent.com/1834657/80652149-a1e37080-8a77-11ea-835a-d9700686877c.png)
Here is for Yolov4:![chart_yolov4-custom](https://user-images.githubusercontent.com/1834657/80652170-b32c7d00-8a77-11ea-8e83-92024427fb02.png)
The final result is "only" similar (I expected much better mAP) and the loss function differs significantly - it looks good for v3 and not so good for v4.
Any help will be appreciated.
Here is my config file:
[net]
Testing
batch=1
subdivisions=1
Training
batch=64 subdivisions=32 width=416 height=416 channels=3 momentum=0.949 decay=0.0005 angle=0 saturation = 1.5 exposure = 1.5 hue=.1
learning_rate=0.001 burn_in=1000 max_batches = 20000 policy=steps steps=16000,18000 scales=.1,.1
cutmix=1
mosaic=1
:104x104 54:52x52 85:26x26 104:13x13 for 416
[convolutional] batch_normalize=1 filters=32 size=3 stride=1 pad=1 activation=mish
Downsample
[convolutional] batch_normalize=1 filters=64 size=3 stride=2 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=64 size=1 stride=1 pad=1 activation=mish
[route] layers = -2
[convolutional] batch_normalize=1 filters=64 size=1 stride=1 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=32 size=1 stride=1 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=64 size=3 stride=1 pad=1 activation=mish
[shortcut] from=-3 activation=linear
[convolutional] batch_normalize=1 filters=64 size=1 stride=1 pad=1 activation=mish
[route] layers = -1,-7
[convolutional] batch_normalize=1 filters=64 size=1 stride=1 pad=1 activation=mish
Downsample
[convolutional] batch_normalize=1 filters=128 size=3 stride=2 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=64 size=1 stride=1 pad=1 activation=mish
[route] layers = -2
[convolutional] batch_normalize=1 filters=64 size=1 stride=1 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=64 size=1 stride=1 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=64 size=3 stride=1 pad=1 activation=mish
[shortcut] from=-3 activation=linear
[convolutional] batch_normalize=1 filters=64 size=1 stride=1 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=64 size=3 stride=1 pad=1 activation=mish
[shortcut] from=-3 activation=linear
[convolutional] batch_normalize=1 filters=64 size=1 stride=1 pad=1 activation=mish
[route] layers = -1,-10
[convolutional] batch_normalize=1 filters=128 size=1 stride=1 pad=1 activation=mish
Downsample
[convolutional] batch_normalize=1 filters=256 size=3 stride=2 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=128 size=1 stride=1 pad=1 activation=mish
[route] layers = -2
[convolutional] batch_normalize=1 filters=128 size=1 stride=1 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=128 size=1 stride=1 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=128 size=3 stride=1 pad=1 activation=mish
[shortcut] from=-3 activation=linear
[convolutional] batch_normalize=1 filters=128 size=1 stride=1 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=128 size=3 stride=1 pad=1 activation=mish
[shortcut] from=-3 activation=linear
[convolutional] batch_normalize=1 filters=128 size=1 stride=1 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=128 size=3 stride=1 pad=1 activation=mish
[shortcut] from=-3 activation=linear
[convolutional] batch_normalize=1 filters=128 size=1 stride=1 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=128 size=3 stride=1 pad=1 activation=mish
[shortcut] from=-3 activation=linear
[convolutional] batch_normalize=1 filters=128 size=1 stride=1 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=128 size=3 stride=1 pad=1 activation=mish
[shortcut] from=-3 activation=linear
[convolutional] batch_normalize=1 filters=128 size=1 stride=1 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=128 size=3 stride=1 pad=1 activation=mish
[shortcut] from=-3 activation=linear
[convolutional] batch_normalize=1 filters=128 size=1 stride=1 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=128 size=3 stride=1 pad=1 activation=mish
[shortcut] from=-3 activation=linear
[convolutional] batch_normalize=1 filters=128 size=1 stride=1 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=128 size=3 stride=1 pad=1 activation=mish
[shortcut] from=-3 activation=linear
[convolutional] batch_normalize=1 filters=128 size=1 stride=1 pad=1 activation=mish
[route] layers = -1,-28
[convolutional] batch_normalize=1 filters=256 size=1 stride=1 pad=1 activation=mish
Downsample
[convolutional] batch_normalize=1 filters=512 size=3 stride=2 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=256 size=1 stride=1 pad=1 activation=mish
[route] layers = -2
[convolutional] batch_normalize=1 filters=256 size=1 stride=1 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=256 size=1 stride=1 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=256 size=3 stride=1 pad=1 activation=mish
[shortcut] from=-3 activation=linear
[convolutional] batch_normalize=1 filters=256 size=1 stride=1 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=256 size=3 stride=1 pad=1 activation=mish
[shortcut] from=-3 activation=linear
[convolutional] batch_normalize=1 filters=256 size=1 stride=1 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=256 size=3 stride=1 pad=1 activation=mish
[shortcut] from=-3 activation=linear
[convolutional] batch_normalize=1 filters=256 size=1 stride=1 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=256 size=3 stride=1 pad=1 activation=mish
[shortcut] from=-3 activation=linear
[convolutional] batch_normalize=1 filters=256 size=1 stride=1 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=256 size=3 stride=1 pad=1 activation=mish
[shortcut] from=-3 activation=linear
[convolutional] batch_normalize=1 filters=256 size=1 stride=1 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=256 size=3 stride=1 pad=1 activation=mish
[shortcut] from=-3 activation=linear
[convolutional] batch_normalize=1 filters=256 size=1 stride=1 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=256 size=3 stride=1 pad=1 activation=mish
[shortcut] from=-3 activation=linear
[convolutional] batch_normalize=1 filters=256 size=1 stride=1 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=256 size=3 stride=1 pad=1 activation=mish
[shortcut] from=-3 activation=linear
[convolutional] batch_normalize=1 filters=256 size=1 stride=1 pad=1 activation=mish
[route] layers = -1,-28
[convolutional] batch_normalize=1 filters=512 size=1 stride=1 pad=1 activation=mish
Downsample
[convolutional] batch_normalize=1 filters=1024 size=3 stride=2 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=512 size=1 stride=1 pad=1 activation=mish
[route] layers = -2
[convolutional] batch_normalize=1 filters=512 size=1 stride=1 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=512 size=1 stride=1 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=512 size=3 stride=1 pad=1 activation=mish
[shortcut] from=-3 activation=linear
[convolutional] batch_normalize=1 filters=512 size=1 stride=1 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=512 size=3 stride=1 pad=1 activation=mish
[shortcut] from=-3 activation=linear
[convolutional] batch_normalize=1 filters=512 size=1 stride=1 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=512 size=3 stride=1 pad=1 activation=mish
[shortcut] from=-3 activation=linear
[convolutional] batch_normalize=1 filters=512 size=1 stride=1 pad=1 activation=mish
[convolutional] batch_normalize=1 filters=512 size=3 stride=1 pad=1 activation=mish
[shortcut] from=-3 activation=linear
[convolutional] batch_normalize=1 filters=512 size=1 stride=1 pad=1 activation=mish
[route] layers = -1,-16
[convolutional] batch_normalize=1 filters=1024 size=1 stride=1 pad=1 activation=mish
##########################
[convolutional] batch_normalize=1 filters=512 size=1 stride=1 pad=1 activation=leaky
[convolutional] batch_normalize=1 size=3 stride=1 pad=1 filters=1024 activation=leaky
[convolutional] batch_normalize=1 filters=512 size=1 stride=1 pad=1 activation=leaky
SPP
[maxpool] stride=1 size=5
[route] layers=-2
[maxpool] stride=1 size=9
[route] layers=-4
[maxpool] stride=1 size=13
[route] layers=-1,-3,-5,-6
End SPP
[convolutional] batch_normalize=1 filters=512 size=1 stride=1 pad=1 activation=leaky
[convolutional] batch_normalize=1 size=3 stride=1 pad=1 filters=1024 activation=leaky
[convolutional] batch_normalize=1 filters=512 size=1 stride=1 pad=1 activation=leaky
[convolutional] batch_normalize=1 filters=256 size=1 stride=1 pad=1 activation=leaky
[upsample] stride=2
[route] layers = 85
[convolutional] batch_normalize=1 filters=256 size=1 stride=1 pad=1 activation=leaky
[route] layers = -1, -3
[convolutional] batch_normalize=1 filters=256 size=1 stride=1 pad=1 activation=leaky
[convolutional] batch_normalize=1 size=3 stride=1 pad=1 filters=512 activation=leaky
[convolutional] batch_normalize=1 filters=256 size=1 stride=1 pad=1 activation=leaky
[convolutional] batch_normalize=1 size=3 stride=1 pad=1 filters=512 activation=leaky
[convolutional] batch_normalize=1 filters=256 size=1 stride=1 pad=1 activation=leaky
[convolutional] batch_normalize=1 filters=128 size=1 stride=1 pad=1 activation=leaky
[upsample] stride=2
[route] layers = 54
[convolutional] batch_normalize=1 filters=128 size=1 stride=1 pad=1 activation=leaky
[route] layers = -1, -3
[convolutional] batch_normalize=1 filters=128 size=1 stride=1 pad=1 activation=leaky
[convolutional] batch_normalize=1 size=3 stride=1 pad=1 filters=256 activation=leaky
[convolutional] batch_normalize=1 filters=128 size=1 stride=1 pad=1 activation=leaky
[convolutional] batch_normalize=1 size=3 stride=1 pad=1 filters=256 activation=leaky
[convolutional] batch_normalize=1 filters=128 size=1 stride=1 pad=1 activation=leaky
##########################
[convolutional] batch_normalize=1 size=3 stride=1 pad=1 filters=256 activation=leaky
[convolutional] size=1 stride=1 pad=1 filters=45 activation=linear
[yolo] mask = 0,1,2 anchors = 12, 16, 19, 36, 40, 28, 36, 75, 76, 55, 72, 146, 142, 110, 192, 243, 459, 401 classes=10 num=9 jitter=.3 ignore_thresh = .7 truth_thresh = 1 scale_x_y = 1.2 iou_thresh=0.213 cls_normalizer=1.0 iou_normalizer=0.07 iou_loss=ciou nms_kind=greedynms beta_nms=0.6
[route] layers = -4
[convolutional] batch_normalize=1 size=3 stride=2 pad=1 filters=256 activation=leaky
[route] layers = -1, -16
[convolutional] batch_normalize=1 filters=256 size=1 stride=1 pad=1 activation=leaky
[convolutional] batch_normalize=1 size=3 stride=1 pad=1 filters=512 activation=leaky
[convolutional] batch_normalize=1 filters=256 size=1 stride=1 pad=1 activation=leaky
[convolutional] batch_normalize=1 size=3 stride=1 pad=1 filters=512 activation=leaky
[convolutional] batch_normalize=1 filters=256 size=1 stride=1 pad=1 activation=leaky
[convolutional] batch_normalize=1 size=3 stride=1 pad=1 filters=512 activation=leaky
[convolutional] size=1 stride=1 pad=1 filters=45 activation=linear
[yolo] mask = 3,4,5 anchors = 12, 16, 19, 36, 40, 28, 36, 75, 76, 55, 72, 146, 142, 110, 192, 243, 459, 401 classes=10 num=9 jitter=.3 ignore_thresh = .7 truth_thresh = 1 scale_x_y = 1.1 iou_thresh=0.213 cls_normalizer=1.0 iou_normalizer=0.07 iou_loss=ciou nms_kind=greedynms beta_nms=0.6
[route] layers = -4
[convolutional] batch_normalize=1 size=3 stride=2 pad=1 filters=512 activation=leaky
[route] layers = -1, -37
[convolutional] batch_normalize=1 filters=512 size=1 stride=1 pad=1 activation=leaky
[convolutional] batch_normalize=1 size=3 stride=1 pad=1 filters=1024 activation=leaky
[convolutional] batch_normalize=1 filters=512 size=1 stride=1 pad=1 activation=leaky
[convolutional] batch_normalize=1 size=3 stride=1 pad=1 filters=1024 activation=leaky
[convolutional] batch_normalize=1 filters=512 size=1 stride=1 pad=1 activation=leaky
[convolutional] batch_normalize=1 size=3 stride=1 pad=1 filters=1024 activation=leaky
[convolutional] size=1 stride=1 pad=1 filters=45 activation=linear
[yolo] mask = 6,7,8 anchors = 12, 16, 19, 36, 40, 28, 36, 75, 76, 55, 72, 146, 142, 110, 192, 243, 459, 401 classes=10 num=9 jitter=.3 ignore_thresh = .7 truth_thresh = 1 random=1 scale_x_y = 1.05 iou_thresh=0.213 cls_normalizer=1.0 iou_normalizer=0.07 iou_loss=ciou nms_kind=greedynms beta_nms=0.6