Open arkerman opened 1 year ago
We recommend using English or English & Chinese for issues so that we could have broader discussion.
@arkerman My guess is that there are no COCO pre-training weights. The configuration we provide uses COCO pre-training weights, while you only have imagenet pre-training weights
Hi , dude ! Thanks for your reply ! I really appreciate it .
It seems that it is not about the pre-trained models . Because i made a test to verify it . I just replaced the backbone with Resnet50 (pre-trained model from torchvision) without MOCO . As i know that the pre-trained model from torchvision used Imagenet .
And here is the config i used :
_base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
# python tools/train.py configs/yolov5/yolov5_s-v61_resnet50_1xb12-100e_cat.py
# python tools/train.py configs/yolov5/yolov5_s-v61_mocov3_fast_1xb12-100e_cat.py --resume
# python tools/test.py configs/yolov5/yolov5_s-v61_mocov3_fast_1xb12-100e_cat.py work_dirs/yolov5_s-v61_mocov3_fast_1xb12-100e_cat/epoch_100.pth --show-dir show_results
deepen_factor = _base_.deepen_factor
widen_factor = 1.0
channels = [512, 1024, 2048]
data_root = './data/cat/'
class_name = ('cat', )
num_classes = len(class_name)
metainfo = dict(classes=class_name, palette=[(20, 220, 60)])
anchors = [
[(68, 69), (154, 91), (143, 162)], # P3/8
[(242, 160), (189, 287), (391, 207)], # P4/16
[(353, 337), (539, 341), (443, 432)] # P5/32
]
max_epochs = 100
train_batch_size_per_gpu = 12
train_num_workers = 1
model = dict(
backbone=dict(
_delete_=True, # 将 _base_ 中关于 backbone 的字段删除
type='mmdet.ResNet', # 使用 mmdet 中的 ResNet
depth=50,
num_stages=4,
out_indices=(1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
norm_eval=True,
style='pytorch',
init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
neck=dict(
type='YOLOv5PAFPN',
widen_factor=widen_factor,
in_channels=channels, # 注意:ResNet-50 输出的3个通道是 [512, 1024, 2048],和原先的 yolov5-s neck 不匹配,需要更改
out_channels=channels),
bbox_head=dict(
type='YOLOv5Head',
head_module=dict(
type='YOLOv5HeadModule',
in_channels=channels, # head 部分输入通道也要做相应更改
widen_factor=widen_factor))
)
train_dataloader = dict(
batch_size=train_batch_size_per_gpu,
num_workers=train_num_workers,
dataset=dict(
data_root=data_root,
metainfo=metainfo,
ann_file='annotations/trainval.json',
data_prefix=dict(img='images/')))
val_dataloader = dict(
dataset=dict(
metainfo=metainfo,
data_root=data_root,
ann_file='annotations/test.json',
data_prefix=dict(img='images/')))
test_dataloader = val_dataloader
_base_.optim_wrapper.optimizer.batch_size_per_gpu = train_batch_size_per_gpu
val_evaluator = dict(ann_file=data_root + 'annotations/test.json')
test_evaluator = val_evaluator
default_hooks = dict(
checkpoint=dict(interval=10, max_keep_ckpts=2, save_best='auto'),
# The warmup_mim_iter parameter is critical.
# The default value is 1000 which is not suitable for cat datasets.
param_scheduler=dict(max_epochs=max_epochs, warmup_mim_iter=10),
logger=dict(type='LoggerHook', interval=5))
train_cfg = dict(max_epochs=max_epochs, val_interval=10)
# visualizer = dict(vis_backends = [dict(type='LocalVisBackend'), dict(type='WandbVisBackend')]) # noqa
Finally , i got the mAP by 60 epochs shown below :
03/17 11:38:12 - mmengine - INFO - Epoch(val) [60][28/28] coco/bbox_mAP: 0.4120 coco/bbox_mAP_50: 0.8290 coco/bbox_mAP_75: 0.2960 coco/bbox_mAP_s
: -1.0000 coco/bbox_mAP_m: -1.0000 coco/bbox_mAP_l: 0.4120
It's normal .
So , i don't know why make the mAP very low when i used MOCO_resnet50 backbone ? Are there any suggestions about this problem to help me fix up ? Any advice will be appreciated !
@hhaAndroid
Prerequisite
💬 Describe the reimplementation questions
Hi ! 我使用yolov5s训练cat数据集,参考的是这个教程(https://mmyolo.readthedocs.io/zh_CN/latest/get_started/15_minutes_object_detection.html)
我想试一下更换v5的主干网络为mmselfsup中的自监督模型,参考的是这个教程(https://mmyolo.readthedocs.io/zh_CN/latest/recommended_topics/replace_backbone.html)
但是我遇到训练的mAP结果并不是很高的现象:
And here is the config i used :
所以为啥这个效果这么差呀?我看moco论文里表明自监督已经能够超过有监督的训练了?还是我配置的不对?求各位请教
Environment
Expected results
No response
Additional information
No response