Closed jveitchmichaelis closed 3 years ago
π Hello @jveitchmichaelis, thank you for your interest in YOLOv5 π! Please visit our βοΈ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution.
If this is a π Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.
If this is a custom training β Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available.
For business inquiries or professional support requests please visit https://ultralytics.com or email Glenn Jocher at glenn.jocher@ultralytics.com.
Python>=3.6.0 with all requirements.txt installed including PyTorch>=1.7. To get started:
$ git clone https://github.com/ultralytics/yolov5
$ cd yolov5
$ pip install -r requirements.txt
YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), validation (val.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit.
@jveitchmichaelis thanks for raising this issue!
@AyushExel can you take a look at this please? Thanks!
I'll try to reproduce this and push a fix today
For what it's worth, checkpoints are saved if I run training directly (eg
python train.py
)
On Mon, Sep 6, 2021, 21:32 Ayush Chaurasia @.***> wrote:
I'll try to reproduce this and push a fix today
β You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ultralytics/yolov5/issues/4672#issuecomment-913499394, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYDMJYWSPOT4JGKN2YOFQTUASDDZANCNFSM5DNM5ACQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
@jveitchmichaelis I wasn't able to reproduce it. I'm currently executing this command from inside the yolov5 folder.
wandb sweep utils/loggers/wandb/sweep.yaml --name sweep_test
wandb agent {sweep id here}
How are you running the sweep? Can you share your sweep.yaml file contents? thanks!
Sure, here's the sweep:
# Hyperparameters for training
# To set range-
# Provide min and max values as:
# parameter:
#
# min: scalar
# max: scalar
# OR
#
# Set a specific list of search space-
# parameter:
# values: [scalar1, scalar2, scalar3...]
#
# You can use grid, bayesian and hyperopt search strategy
# For more info on configuring sweeps visit - https://docs.wandb.ai/guides/sweeps/configuration
program: utils/loggers/wandb/sweep.py
method: grid
metric:
name: metrics/mAP_0.5
goal: maximize
parameters:
# hyperparameters: set either min, max range or values list
weights:
value: yolov5s.pt
data:
values: ["../configs/dataset_10.yaml", "../configs/dataset_5.yaml", "../configs/dataset.yaml"]
batch_size:
values: [4, 8, 16]
epochs:
distribution: constant
value: 150
workers:
distribution: constant
value: 2
img:
distribution: constant
value: 640
lr0:
distribution: constant
value: 0.0016
lrf: # final cyclic training rate, lr0 * lrf!
distribution: constant
value: 0.06
momentum:
distribution: constant
value: 0.843
weight_decay:
distribution: constant
value: 0.00036
warmup_epochs:
distribution: constant
value: 5
warmup_momentum:
distribution: constant
value: 0.5
warmup_bias_lr:
distribution: constant
value: 0.05
box:
distribution: constant
value: 0.0296
cls:
distribution: constant
value: 0.243
cls_pw:
distribution: constant
value: 0.631
obj:
distribution: constant
value: 0.301
obj_pw:
distribution: constant
value: 0.911
iou_t:
distribution: constant
value: 0.2
anchor_t:
distribution: constant
value: 2.91
# Augmentation
fl_gamma:
distribution: constant
value: 0.0
hsv_h:
distribution: constant
value: 0.0138
hsv_s:
distribution: constant
value: 0.664
hsv_v:
distribution: constant
value: 0.464
degrees:
distribution: constant
value: 0.373
translate:
distribution: constant
value: 0.245
scale:
distribution: constant
value: 0.898
shear:
distribution: constant
value: 0.602
perspective:
distribution: constant
value: 0.0
flipud:
distribution: constant
value: 0.5
fliplr:
distribution: constant
value: 0.5
mosaic:
distribution: constant
value: 1.0
mixup:
distribution: constant
value: 0.342
copy_paste:
distribution: constant
value: 0.0
and yep, I'm running from the folder with:
wandb sweep ../configs/sweep_constant.yaml --name etc #above
wandb agent {sweep id}
I have yolov5 as a submodule inside my dataset repository, but I don't think it should make a difference
Thanks I'm trying to repro. I'll update soon
@jveitchmichaelis Okay I tried running the sweep for 150 epochs and I didn't see any error. Is this error reproducible from your end? Run the same command again to repro ( if you haven't done this already)
Yeah I'll try again. There are some other odd things which I'm trying to dig into. Here's an output from a non-sweep run:
python train.py --img 640 --device 0 --batch 8 --epochs 200 --workers 4 --data ../configs/final_ultralytics_5.yaml --weights yolov5m.pt --hyp ../configs/hyp.finetune.yaml --entity <me> --project project_name--save_period 10
the run stops early (fine):
Epoch gpu_mem box obj cls labels img_size
32/199 6.01G 0.01985 0.003756 0.0005924 2 640: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 742/742 [02:59<00:00, 4.14it/s]
Class Images Labels P R mAP@.5 mAP@.5:.95: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 89/89 [00:13<00:00, 6.60it/s]
all 1415 3611 0.384 0.35 0.335 0.15
EarlyStopping patience 30 exceeded, stopping training.
33 epochs completed in 1.782 hours.
Optimizer stripped from <project_name>/exp10/weights/last.pt, 93.7MB
Optimizer stripped from <project_name>/exp10/weights/best.pt, 93.7MB
wandb: Waiting for W&B process to finish, PID 27174
wandb: Program ended successfully.
...
you can see that the weights are created - here's the output folder:
(yolo) user@mimir:~/code/yolov5/<project_name>/exp10$ tree -L 2
.
βββ events.out.tfevents.1631138661.mimir.27098.0
βββ hyp.yaml
βββ labels_correlogram.jpg
βββ labels.jpg
βββ opt.yaml
βββ results.csv
βββ results.png
βββ train_batch0.jpg
βββ train_batch1.jpg
βββ train_batch2.jpg
βββ weights
βββ best.pt
βββ last.pt
1 directory, 12 files
So that's OK. But oddly there is no confusion matrix, per-class-AP is not printed to the log file, and I suppose as a result, the matrix image doesn't get uploaded to wandb either.
EDIT: It looks like this got fixed a few days ago with updates to the early stopping functionality. I'll test again...
@jveitchmichaelis some of your questions are addressed in EarlyStopping updates PR https://github.com/ultralytics/yolov5/pull/4679, which increases the default patience to 100 and fixes the lack of validation results you mentioned (no confusion matrix etc.)
@glenn-jocher Yep - I just saw, thanks! The fix was only a few days ago, so I've re-pulled and will test again. It's possible that the same issue was causing weights to not be created.
@AyushExel - I'll try a sweep with e.g. 1 epoch and see if it still occurs
π Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs.
Access additional YOLOv5 π resources:
Access additional Ultralytics β‘ resources:
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!
Thank you for your contributions to YOLOv5 π and Vision AI β!
π Bug
When training using a wandb sweep, the call to
log_artifact
at the end of the run fails with a ValueError that the path is not correct.To Reproduce (REQUIRED)
Run a sweep e.g:
Example config:
Output (presumably at an early-stopping point as the epoch number is always less than max):
Adding a try/except block around the call gives the following path:
but the weight folder is empty. So for some reason the run is terminating, but it's not saving the final checkpoint?
Expected behavior
The artifact (e.g. best/last) model is uploaded.
Environment
If applicable, add screenshots to help explain your problem.