Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

version 7.0 #8655

Closed
1 task done
parthmalpathak opened this issue Jul 20, 2022 · 9 comments
Closed
1 task done

version 7.0 #8655

parthmalpathak opened this issue Jul 20, 2022 · 9 comments
Labels
question Further information is requested

Comments

@parthmalpathak
Copy link

Search before asking

Question

When is the version 7.0 expected to be released?

Additional

No response

@parthmalpathak parthmalpathak added the question Further information is requested label Jul 20, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Jul 20, 2022

👋 Hello @parthmalpathak, 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 support@ultralytics.com.

Requirements

Python>=3.7.0 with all requirements.txt installed including PyTorch>=1.7. To get started:

git clone https://github.com/ultralytics/yolov5  # clone
cd yolov5
pip install -r requirements.txt  # install

Environments

YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

CI CPU testing

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.

@glenn-jocher
Copy link
Member

@parthmalpathak we have an upcoming 6.2 release that should be out in the next few weeks. The major addition there will be classification support migrating to master branch!

@zhiqwang
Copy link
Contributor

zhiqwang commented Jul 24, 2022

we have an upcoming 6.2 release that should be out in the next few weeks. The major addition there will be classification support migrating to master branch!

Hi @glenn-jocher, Will there be a detection model released pre-trained with the ImageNet datasets when the time comes?

Seems that training from ImageNet can

  • Use less epochs and training time
  • Use lightweight data augmentation skills, for example, it can be done without the mosaic augmentation.

@glenn-jocher
Copy link
Member

glenn-jocher commented Jul 25, 2022

@zhiqwang yes sort of! We'll have imagenet trained classification models. I'm training them right now, adjusting some settings to get good results. The command I'm using right now is only training imagenet to 30 epochs, but for the final release we'll train to 300 epochs.

The YOLOv5m classifier trains to similar results as ResNet50 and EfficientNet_b0 in 30 epochs, around 0.70 top1 and 0.90 top5, but trains will a bit less CUDA memory and runs a little faster.

!python -m torch.distributed.run --nproc_per_node 4 --master_port 20 classifier.py --pretrained False --data imagenet --epochs 30 --img 224 --batch 512 --device 0,1,2,3 --model yolov5m --lr 0.001 --label-smoothing 0.2

Screen Shot 2022-07-25 at 2 49 21 PM

@zhiqwang
Copy link
Contributor

Hi @glenn-jocher

The YOLOv5m classifier trains to similar results as ResNet50 and EfficientNet_b0 in 30 epochs, around 0.70 top1 and 0.90 top5, but trains will a bit less CUDA memory and runs a little faster.

It's awesome!

Seems that you're using the following mean and std pairs when training the ImageNet models

IMAGENET_MEAN = 0.485, 0.456, 0.406 # RGB mean
IMAGENET_STD = 0.229, 0.224, 0.225 # RGB standard deviation

If so, it seems that when the detection branch also wants to use this pre-trained model, it would have to use the same mean and std, which would conflict with the (0, 1) pairs used by the current mechanism?

@zhiqwang
Copy link
Contributor

zhiqwang commented Jul 25, 2022

Just FYI @glenn-jocher , TorchVision team has previously summarized an article for training SOTA models on ImageNet https://pytorch.org/blog/how-to-train-state-of-the-art-models-using-torchvision-latest-primitives/

Accuracy@1 Accuracy@5 Incremental Diff Absolute Diff
ResNet50 Baseline 76.130 92.862 0.000 0.000
+ LR optimizations 76.494 93.198 0.364 0.364
+ TrivialAugment 76.806 93.272 0.312 0.676
+ Long Training 78.606 94.052 1.800 2.476
+ Random Erasing 78.796 94.094 0.190 2.666
+ Label Smoothing 79.114 94.374 0.318 2.984
+ Mixup 79.232 94.536 0.118 3.102
+ Cutmix 79.510 94.642 0.278 3.380
+ Weight Decay tuning 80.036 94.746 0.526 3.906
+ FixRes mitigations 80.196 94.672 0.160 4.066
+ EMA 80.450 94.908 0.254 4.320
+ Inference Resize tuning * 80.674 95.166 0.224 4.544
+ Repeated Augmentation ** 80.858 95.434 0.184 4.728

* The tuning of the inference size was done on top of the last model.
** Community contribution done after the release of the article.

@glenn-jocher
Copy link
Member

glenn-jocher commented Jul 26, 2022

@zhiqwang really good summary! Thanks for the table. Hopefully we score somewhere in the middle there with our default training script.

Unfortunately the biggest jump they observed was simply from going from 90 epochs to 600 (+ Long Training), but all the small incremental gains do add up from their other experiments.. We don't have many of the more advanced augmentations built in right now, but we should also investigate those. We currently have Weight Decay 1e-5, EMA 0.9999 and Label Smoothing 0.2 enabled by default. Dropout was something I saw in efficientnet_v2, so I put in our Classify() head but have it set to 0.0 by default until we can run more experiments:

yolov5/models/common.py

Lines 738 to 751 in 0551a31

class Classify(nn.Module):
# Classification head, i.e. x(b,c1,20,20) to x(b,c2)
def __init__(self, c1, c2, k=1, s=1, p=None, g=1): # ch_in, ch_out, kernel, stride, padding, groups
super().__init__()
c_ = 1280 # efficientnet_b0 size
self.conv = Conv(c1, c_, k, s, autopad(k, p), g)
self.pool = nn.AdaptiveAvgPool2d(1) # to x(b,c_,1,1)
self.drop = nn.Dropout(p=0.0, inplace=True)
self.linear = nn.Linear(c_, c2) # to x(b,c2)
def forward(self, x):
if isinstance(x, list):
x = torch.cat(x, 1)
return self.linear(self.drop(self.pool(self.conv(x)).flatten(1)))

An additional challenge is that was works really well on ImageNet from scratch is very different than what works well for finetuning smaller datasets on pretrained models, which is probably the most common real-world use case and likely needs separate hyps.

I think this first release will really be about publicising the effort and hopefully getting more eyeballs on classifier.py to allow community contributions to improve the code.

@zhiqwang
Copy link
Contributor

I think this first release will really be about publicising the effort and hopefully getting more eyeballs on classifier.py to allow community contributions to improve the code.

Yep, that's a great start! And looking forward to more models being integrated into yolov5.

@glenn-jocher
Copy link
Member

@zhiqwang absolutely! We're excited about the journey ahead and appreciate your support. Keep an eye out for more improvements and additions in the future. Thank you for your valuable input!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants