Closed pprp closed 4 years ago
@pprp you are using random numbers in parts of the code....so obviously they are not going to be the same.
@FranciscoReveriano Thank you for your reply. Do you know which part of the code is causing the problem?
@pprp there are certain segments of the training that are necessarily stochastic rather than deterministic. See https://pytorch.org/docs/stable/notes/randomness.html
In any case, your two training runs are nearly identical (and both at very high mAPs), so I'd say the performance is as good as you can expect.
@pprp and to be clear, all deterministic and same-seed settings are already in place, so there are no further actions to take to improve reproducibility on CUDA.
@glenn-jocher Thanks for your reply, I re-tested a few times later and found that each time the results are very uncertain. Since my data is relatively simple, each time the improvement is 1-2%, so the results obtained by each training are different, even more than 1%, which greatly affects my judgment. Do you have any good ideas to solve this problem?
@pprp this is a pytorch issue, not specific to this repo. I recommend you post it there. I don't have any additional info beyond what I've already said.
@glenn-jocher Ok thank you for your help:smile:
@pprp you're welcome! It's a frustrating problem with CNN training in general, it happens often to us as well. Unfortunately I don't think it's going away anytime soon, because of the combination of random number generators in the different packages used (python, pytorch, numpy), and the spread of random numbers generated between CPU and CUDA.
If you find a solution or make any progress please post an update here!
I find some possible problem.
https://github.com/pytorch/pytorch/issues/12207
There are some code using random and np.random in LoadImagesAndLabels
if we set augment=True
When using multiple threads, you need to fix the seed for each thread.
or just change num of workers to 1
I mainly made the above changes, and then carried out multiple experiments, and found that it can be reproduced at about 10 epochs, but when the epoch is set more, the reproducibility will have problems.
First run:
Using 1 dataloader workers
Starting training for 40 epochs...
Epoch gpu_mem GIoU obj cls total targets img_size
0/39 1.01G 3.43 9.42 0 12.8 14 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:30<00:00, 7.12it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:04<00:00, 2.66it/s]
all 391 409 0.336 0.325 0.125 0.33
Epoch gpu_mem GIoU obj cls total targets img_size
1/39 1.29G 2.27 6.02 0 8.29 15 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 8.08it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.66it/s]
all 391 409 0.709 0.866 0.698 0.78
Epoch gpu_mem GIoU obj cls total targets img_size
2/39 1.29G 1.69 4.51 0 6.2 15 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 8.12it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.53it/s]
all 391 409 0.833 0.912 0.854 0.87
Epoch gpu_mem GIoU obj cls total targets img_size
3/39 1.29G 1.5 3.91 0 5.41 16 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 8.12it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.87it/s]
all 391 409 0.884 0.949 0.899 0.915
Epoch gpu_mem GIoU obj cls total targets img_size
4/39 1.29G 1.39 3.59 0 4.97 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.30it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.89it/s]
all 391 409 0.909 0.951 0.928 0.93
Epoch gpu_mem GIoU obj cls total targets img_size
5/39 1.29G 1.32 3.37 0 4.68 14 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.27it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.86it/s]
all 391 409 0.908 0.944 0.922 0.926
Epoch gpu_mem GIoU obj cls total targets img_size
6/39 1.29G 1.26 3.2 0 4.47 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 8.05it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.81it/s]
all 391 409 0.909 0.951 0.925 0.93
Epoch gpu_mem GIoU obj cls total targets img_size
7/39 1.29G 1.21 3.08 0 4.3 15 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.23it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.84it/s]
all 391 409 0.925 0.968 0.955 0.946
Epoch gpu_mem GIoU obj cls total targets img_size
8/39 1.29G 1.18 2.96 0 4.14 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.26it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.93it/s]
all 391 409 0.936 0.958 0.941 0.947
Epoch gpu_mem GIoU obj cls total targets img_size
9/39 1.29G 1.15 2.89 0 4.04 14 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 8.12it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.83it/s]
all 391 409 0.932 0.968 0.958 0.95
Epoch gpu_mem GIoU obj cls total targets img_size
10/39 1.29G 1.11 2.81 0 3.92 14 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.25it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.75it/s]
all 391 409 0.938 0.966 0.954 0.952
Epoch gpu_mem GIoU obj cls total targets img_size
11/39 1.29G 1.09 2.73 0 3.82 15 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.29it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.87it/s]
all 391 409 0.939 0.976 0.963 0.957
Epoch gpu_mem GIoU obj cls total targets img_size
12/39 1.29G 1.06 2.67 0 3.74 14 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 8.14it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.66it/s]
all 391 409 0.943 0.973 0.969 0.958
Epoch gpu_mem GIoU obj cls total targets img_size
13/39 1.29G 1.04 2.61 0 3.65 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 7.99it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.62it/s]
all 391 409 0.932 0.971 0.96 0.951
Epoch gpu_mem GIoU obj cls total targets img_size
14/39 1.29G 1.02 2.56 0 3.57 14 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.28it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.69it/s]
all 391 409 0.947 0.966 0.96 0.956
Epoch gpu_mem GIoU obj cls total targets img_size
15/39 1.29G 0.998 2.5 0 3.5 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:28<00:00, 7.80it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.94it/s]
all 391 409 0.959 0.971 0.972 0.965
Epoch gpu_mem GIoU obj cls total targets img_size
16/39 1.29G 0.982 2.46 0 3.44 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 8.05it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.83it/s]
all 391 409 0.955 0.976 0.971 0.965
Epoch gpu_mem GIoU obj cls total targets img_size
17/39 1.29G 0.959 2.41 0 3.37 14 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 8.02it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.89it/s]
all 391 409 0.961 0.971 0.974 0.966
Epoch gpu_mem GIoU obj cls total targets img_size
18/39 1.29G 0.937 2.36 0 3.3 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 8.10it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.83it/s]
all 391 409 0.952 0.971 0.969 0.961
Epoch gpu_mem GIoU obj cls total targets img_size
19/39 1.29G 0.923 2.32 0 3.24 14 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 8.14it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.92it/s]
all 391 409 0.947 0.971 0.967 0.959
Epoch gpu_mem GIoU obj cls total targets img_size
20/39 1.29G 0.907 2.28 0 3.19 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.32it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.81it/s]
all 391 409 0.94 0.961 0.956 0.95
Epoch gpu_mem GIoU obj cls total targets img_size
21/39 1.29G 0.891 2.24 0 3.13 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 7.95it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.85it/s]
all 391 409 0.945 0.968 0.961 0.957
Epoch gpu_mem GIoU obj cls total targets img_size
22/39 1.29G 0.877 2.22 0 3.1 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.15it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.89it/s]
all 391 409 0.959 0.973 0.973 0.966
Epoch gpu_mem GIoU obj cls total targets img_size
23/39 1.29G 0.858 2.17 0 3.03 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.19it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.62it/s]
all 391 409 0.945 0.976 0.97 0.96
Epoch gpu_mem GIoU obj cls total targets img_size
24/39 1.29G 0.854 2.15 0 3.01 14 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.17it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.56it/s]
all 391 409 0.961 0.971 0.968 0.966
Epoch gpu_mem GIoU obj cls total targets img_size
25/39 1.29G 0.831 2.11 0 2.95 14 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 8.03it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.54it/s]
all 391 409 0.954 0.968 0.962 0.961
Epoch gpu_mem GIoU obj cls total targets img_size
26/39 1.29G 0.82 2.08 0 2.9 21 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.24it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.72it/s]
all 391 409 0.952 0.978 0.972 0.965
Epoch gpu_mem GIoU obj cls total targets img_size
27/39 1.29G 0.802 2.05 0 2.85 14 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.22it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.93it/s]
all 391 409 0.956 0.958 0.951 0.957
Epoch gpu_mem GIoU obj cls total targets img_size
28/39 1.29G 0.786 2.01 0 2.8 14 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 8.03it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.83it/s]
all 391 409 0.951 0.954 0.942 0.952
Epoch gpu_mem GIoU obj cls total targets img_size
29/39 1.29G 0.773 1.98 0 2.75 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.31it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.73it/s]
all 391 409 0.942 0.956 0.944 0.949
Epoch gpu_mem GIoU obj cls total targets img_size
30/39 1.29G 0.762 1.96 0 2.72 15 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.25it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.83it/s]
all 391 409 0.952 0.973 0.972 0.963
Epoch gpu_mem GIoU obj cls total targets img_size
31/39 1.29G 0.745 1.92 0 2.67 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.21it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.83it/s]
all 391 409 0.966 0.973 0.974 0.97
Epoch gpu_mem GIoU obj cls total targets img_size
32/39 1.29G 0.739 1.91 0 2.65 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 8.03it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:05<00:00, 2.30it/s]
all 391 409 0.968 0.971 0.971 0.969
Epoch gpu_mem GIoU obj cls total targets img_size
33/39 1.29G 0.725 1.89 0 2.61 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.26it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.66it/s]
all 391 409 0.959 0.966 0.96 0.962
Epoch gpu_mem GIoU obj cls total targets img_size
34/39 1.29G 0.712 1.85 0 2.56 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.20it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.48it/s]
all 391 409 0.966 0.98 0.983 0.973
Epoch gpu_mem GIoU obj cls total targets img_size
35/39 1.29G 0.704 1.84 0 2.54 14 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.30it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.55it/s]
all 391 409 0.964 0.976 0.971 0.97
Epoch gpu_mem GIoU obj cls total targets img_size
36/39 1.29G 0.689 1.81 0 2.49 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 8.01it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.52it/s]
all 391 409 0.966 0.973 0.974 0.97
Epoch gpu_mem GIoU obj cls total targets img_size
37/39 1.29G 0.679 1.79 0 2.46 15 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 8.02it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.63it/s]
all 391 409 0.969 0.978 0.973 0.973
Epoch gpu_mem GIoU obj cls total targets img_size
38/39 1.29G 0.676 1.79 0 2.46 14 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:25<00:00, 8.60it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.63it/s]
all 391 409 0.961 0.968 0.962 0.965
Epoch gpu_mem GIoU obj cls total targets img_size
39/39 1.29G 0.664 1.76 0 2.42 15 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.20it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.62it/s]
all 391 409 0.968 0.973 0.973 0.971
40 epochs completed in 0.350 hours.
Second run:
Using 1 dataloader workers
Starting training for 40 epochs...
Epoch gpu_mem GIoU obj cls total targets img_size
0/39 1.01G 3.43 9.42 0 12.8 14 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:30<00:00, 7.19it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:04<00:00, 2.70it/s]
all 391 409 0.336 0.325 0.125 0.33
Epoch gpu_mem GIoU obj cls total targets img_size
1/39 1.29G 2.27 6.02 0 8.29 15 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 8.12it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.44it/s]
all 391 409 0.709 0.866 0.698 0.78
Epoch gpu_mem GIoU obj cls total targets img_size
2/39 1.29G 1.69 4.51 0 6.2 15 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 8.01it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.68it/s]
all 391 409 0.833 0.912 0.854 0.87
Epoch gpu_mem GIoU obj cls total targets img_size
3/39 1.29G 1.5 3.91 0 5.41 16 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.29it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.60it/s]
all 391 409 0.884 0.949 0.899 0.915
Epoch gpu_mem GIoU obj cls total targets img_size
4/39 1.29G 1.39 3.59 0 4.97 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 7.94it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.82it/s]
all 391 409 0.909 0.951 0.928 0.93
Epoch gpu_mem GIoU obj cls total targets img_size
5/39 1.29G 1.32 3.37 0 4.68 14 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 8.00it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.81it/s]
all 391 409 0.908 0.944 0.922 0.926
Epoch gpu_mem GIoU obj cls total targets img_size
6/39 1.29G 1.26 3.2 0 4.47 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.26it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.94it/s]
all 391 409 0.909 0.951 0.925 0.93
Epoch gpu_mem GIoU obj cls total targets img_size
7/39 1.29G 1.21 3.08 0 4.3 15 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.23it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.87it/s]
all 391 409 0.925 0.968 0.955 0.946
Epoch gpu_mem GIoU obj cls total targets img_size
8/39 1.29G 1.18 2.96 0 4.14 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 7.98it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.68it/s]
all 391 409 0.936 0.958 0.941 0.947
Epoch gpu_mem GIoU obj cls total targets img_size
9/39 1.29G 1.15 2.89 0 4.04 14 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.33it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.80it/s]
all 391 409 0.932 0.968 0.958 0.95
Epoch gpu_mem GIoU obj cls total targets img_size
10/39 1.29G 1.11 2.81 0 3.92 14 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.32it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.50it/s]
all 391 409 0.938 0.966 0.954 0.952
Epoch gpu_mem GIoU obj cls total targets img_size
11/39 1.29G 1.09 2.73 0 3.82 15 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.16it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.57it/s]
all 391 409 0.939 0.976 0.966 0.957
Epoch gpu_mem GIoU obj cls total targets img_size
12/39 1.29G 1.07 2.68 0 3.74 14 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.31it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.61it/s]
all 391 409 0.948 0.976 0.972 0.961
Epoch gpu_mem GIoU obj cls total targets img_size
13/39 1.29G 1.04 2.61 0 3.65 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 8.05it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.52it/s]
all 391 409 0.937 0.976 0.967 0.956
Epoch gpu_mem GIoU obj cls total targets img_size
14/39 1.29G 1.02 2.56 0 3.58 14 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 7.97it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.41it/s]
all 391 409 0.944 0.951 0.952 0.948
Epoch gpu_mem GIoU obj cls total targets img_size
15/39 1.29G 0.996 2.5 0 3.49 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 8.06it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.57it/s]
all 391 409 0.952 0.973 0.97 0.963
Epoch gpu_mem GIoU obj cls total targets img_size
16/39 1.29G 0.981 2.46 0 3.44 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.16it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.30it/s]
all 391 409 0.95 0.973 0.968 0.961
Epoch gpu_mem GIoU obj cls total targets img_size
17/39 1.29G 0.961 2.41 0 3.37 14 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.39it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.80it/s]
all 391 409 0.961 0.968 0.964 0.965
Epoch gpu_mem GIoU obj cls total targets img_size
18/39 1.29G 0.938 2.36 0 3.3 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.32it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.88it/s]
all 391 409 0.95 0.971 0.967 0.96
Epoch gpu_mem GIoU obj cls total targets img_size
19/39 1.29G 0.925 2.32 0 3.25 14 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 8.14it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.76it/s]
all 391 409 0.957 0.971 0.97 0.964
Epoch gpu_mem GIoU obj cls total targets img_size
20/39 1.29G 0.905 2.28 0 3.19 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.35it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.30it/s]
all 391 409 0.952 0.971 0.973 0.961
Epoch gpu_mem GIoU obj cls total targets img_size
21/39 1.29G 0.893 2.25 0 3.14 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.21it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.45it/s]
all 391 409 0.954 0.971 0.971 0.962
Epoch gpu_mem GIoU obj cls total targets img_size
22/39 1.29G 0.878 2.22 0 3.1 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 7.91it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.59it/s]
all 391 409 0.948 0.973 0.972 0.96
Epoch gpu_mem GIoU obj cls total targets img_size
23/39 1.29G 0.861 2.17 0 3.03 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:28<00:00, 7.84it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.59it/s]
all 391 409 0.952 0.971 0.97 0.961
Epoch gpu_mem GIoU obj cls total targets img_size
24/39 1.29G 0.852 2.15 0 3 14 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 8.15it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.60it/s]
all 391 409 0.966 0.976 0.969 0.971
Epoch gpu_mem GIoU obj cls total targets img_size
25/39 1.29G 0.832 2.11 0 2.95 14 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 8.06it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.43it/s]
all 391 409 0.947 0.971 0.97 0.959
Epoch gpu_mem GIoU obj cls total targets img_size
26/39 1.29G 0.818 2.08 0 2.9 21 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 8.02it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.77it/s]
all 391 409 0.952 0.968 0.961 0.96
Epoch gpu_mem GIoU obj cls total targets img_size
27/39 1.29G 0.801 2.05 0 2.85 14 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:28<00:00, 7.71it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.85it/s]
all 391 409 0.966 0.966 0.96 0.966
Epoch gpu_mem GIoU obj cls total targets img_size
28/39 1.29G 0.788 2.02 0 2.81 14 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:27<00:00, 8.00it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.84it/s]
all 391 409 0.964 0.976 0.97 0.97
Epoch gpu_mem GIoU obj cls total targets img_size
29/39 1.29G 0.773 1.98 0 2.76 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.25it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.81it/s]
all 391 409 0.951 0.956 0.94 0.954
Epoch gpu_mem GIoU obj cls total targets img_size
30/39 1.29G 0.764 1.97 0 2.73 15 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.26it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.74it/s]
all 391 409 0.957 0.973 0.971 0.965
Epoch gpu_mem GIoU obj cls total targets img_size
31/39 1.29G 0.748 1.93 0 2.68 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:28<00:00, 7.72it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.85it/s]
all 391 409 0.954 0.963 0.957 0.959
Epoch gpu_mem GIoU obj cls total targets img_size
32/39 1.29G 0.734 1.9 0 2.64 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.19it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.57it/s]
all 391 409 0.963 0.966 0.958 0.965
Epoch gpu_mem GIoU obj cls total targets img_size
33/39 1.29G 0.725 1.89 0 2.61 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.22it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:04<00:00, 3.11it/s]
all 391 409 0.954 0.961 0.96 0.957
Epoch gpu_mem GIoU obj cls total targets img_size
34/39 1.29G 0.72 1.86 0 2.58 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:26<00:00, 8.33it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.49it/s]
all 391 409 0.959 0.971 0.97 0.965
Epoch gpu_mem GIoU obj cls total targets img_size
35/39 1.29G 0.7 1.84 0 2.54 14 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:30<00:00, 7.18it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:04<00:00, 3.18it/s]
all 391 409 0.959 0.968 0.959 0.964
Epoch gpu_mem GIoU obj cls total targets img_size
36/39 1.29G 0.69 1.81 0 2.5 13 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:28<00:00, 7.68it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.43it/s]
all 391 409 0.973 0.971 0.974 0.972
Epoch gpu_mem GIoU obj cls total targets img_size
37/39 1.29G 0.68 1.79 0 2.47 15 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:28<00:00, 7.67it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.71it/s]
all 391 409 0.969 0.978 0.974 0.973
Epoch gpu_mem GIoU obj cls total targets img_size
38/39 1.29G 0.671 1.78 0 2.45 14 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:28<00:00, 7.79it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.75it/s]
all 391 409 0.964 0.973 0.973 0.968
Epoch gpu_mem GIoU obj cls total targets img_size
39/39 1.29G 0.663 1.76 0 2.42 15 416: 100%|█████████████████████████████████████████████████████████████████████████| 220/220 [00:28<00:00, 7.65it/s]
Class Images Targets P R mAP@0.5 F1: 100%|███████████████████████████████████████████████████████████████████████████| 13/13 [00:03<00:00, 3.72it/s]
all 391 409 0.975 0.973 0.974 0.974
40 epochs completed in 0.355 hours.
@pprp I don't know who is teaching you machine learning. But exact reproducibility is not possible because this models are not deterministic. This is why we proceed to use other testing methods for reproducibility. Such as multiple runs or k-folds. Within multiple runs, you should be very close to the same score. If you are not there is a problem with your model/code/dataset/validation mechanisms.
Making/Running models is very easy but is not machine learning. Machine learning is being able to create proper validation datasets that support a thesis that you created. Personally I wouldn' ttrust any paper or anyone that told me they got the same score twice in a model, clear black sign that their results are not to be trusted.
Well, I just want to minimize uncertainty. I mean, the introduction of the upsample layer brings a relatively large amount of uncertainty. @FranciscoReveriano Thank you for your reply.
@pprp yes your 3 factors are likely sources of irreproducibility. Random number generators should not be a source, because all seeds are set to 0 at the beginning of training:
https://github.com/ultralytics/yolov3/blob/f743235fac9571a8ef8fdf873fd480c2abf5930d/train.py#L61-L62
The sources of randomness with FP32 operations (and moreso with FP16 operations, i.e. when using nvidia apex to train) are due to the multithreaded operations. Setting workers=0 (not workers=1) will eliminate multi-threading from the dataloader, and setting --device cpu will remove CUDA operations from the equation obviously, but both of these are terrible solutions as they slow down training significantly.
Any multithreaded operation may introduce issues, even summing a single vector, as the thread summations will incur precision loss at FP16/32, such that the order and the threadcount will affect the result slightly. This is essentially mentioned in the link I posted earlier: https://pytorch.org/docs/stable/notes/randomness.html
There are some PyTorch functions that use CUDA functions that can be a source of non-determinism. One class of such CUDA functions are atomic operations, in particular atomicAdd, where the order of parallel additions to the same value is undetermined and, for floating-point variables, a source of variance in the result. PyTorch functions that use atomicAdd in the forward include torch.Tensor.indexadd(), torch.Tensor.scatteradd(), torch.bincount().
A number of operations have backwards that use atomicAdd, in particular torch.nn.functional.embedding_bag(), torch.nn.functional.ctc_loss() and many forms of pooling, padding, and sampling. There currently is no simple way of avoiding non-determinism in these functions.
I've observed perfectly reproduced training runs on occasion, but it's more often than not that different training runs will return you slightly different results. For example if we train COCO 10 times we might expect the results to match within <1%, which is what you are seeing in your results as well.
@glenn-jocher Thank you for pointing out the problem and providing suggestions. I really appreciate you help.:smile:
@pprp You're welcome! I'm glad I could provide some insight. If there's anything else I can help you with, feel free to ask. Happy training! 😊
Thank you for your outstanding work, I want to improve the network structure on my own database. However, I found a problem. After training the same network multiple times, the final results were very different.
first run:
second run:
The above two experiments are the same data, the same network, without changing any parameters.
This really confuses me. If each experiment cannot be reproduced, it is difficult to know whether the map promotion is caused by random factors or the network structure.
I also noticed that the init_seeds method has been used in the code. But why the two training results are inconsistent? Do you have any suggestions for this?