We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
把马赛克数据增强和mixup等数据增强方式放入
你好,我想把马赛克数据增强和mixup等数据增强方式放入代码中,看他检测效果怎么样,我应该怎么添加代码?
No response
The text was updated successfully, but these errors were encountered:
Hi @sevenandseven 我在代码已经集成了Mosaic和Mixup数据增强,以及优化后的CachedMosaic和CachedMixup,在定义数据增强的时候使用就可以了(参考下方代码),不需要更改其他代码。推荐使用CachedMosaic和CachedMixup,这两个效率更快。
mosaic_mixup = T.Compose([ T.RandomHorizontalFlip(), Mosaic(p=1.0), # Mosaic p是随机增强的概率 MixUp(p=1.0), # Mixup T.PILToTensor(), T.ConvertImageDtype(torch.float), T.Normalize(mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225)), T.SanitizeBoundingBox(labels_getter=labels_getter), ])
我也在transforms/presets.py文件中给出了几个示例(mosaic、cached_mosaic、mixup、cached_mixup、mixup_mosaic、cached_mixup_mosaic、mosaic_mixup、cached_mosaic_mixup),参考这些您可以用mosaic和mixup来自定义其他的数据增强,然后在configs/train_config.py中使用。
transforms/presets.py
mosaic
cached_mosaic
mixup
cached_mixup
mixup_mosaic
cached_mixup_mosaic
mosaic_mixup
cached_mosaic_mixup
configs/train_config.py
训练前可以用tools/visualize_datasets.py可视化数据增强的结果,下面是一些示例代码和产生的可视化结果:
tools/visualize_datasets.py
CachedMosaic:
python tools/visualize_datasets.py --coco-img data/coco/val2017 --coco-ann data/coco/annotations/instances_val2017.json --transform cached_mosaic --show-dir visualization/coco_mosaic --font-scale 0.5 --text-alpha 0.7
CachedMixup:
python tools/visualize_datasets.py --coco-img data/coco/val2017 --coco-ann data/coco/annotations/instances_val2017.json --transform cached_mixup --show-dir visualization/coco_mixup --font-scale 0.5 --text-alpha 0.7
同时使用CachedMosaic和CachedMixup:
python tools/visualize_datasets.py --coco-img data/coco/val2017 --coco-ann data/coco/annotations/instances_val2017.json --transform cached_mosaic_mixup --show-dir visualization/coco --font-scale 0.5 --text-alpha 0.7
上面这行命令在COCO数据集上应用了transforms/presets.py中定义的cached_mosaic_mixup数据增强,可视化结果如下:
Sorry, something went wrong.
No branches or pull requests
功能描述
把马赛克数据增强和mixup等数据增强方式放入
用例
你好,我想把马赛克数据增强和mixup等数据增强方式放入代码中,看他检测效果怎么样,我应该怎么添加代码?
补充信息
No response
The text was updated successfully, but these errors were encountered: