zylo117 / Yet-Another-EfficientDet-Pytorch

The pytorch re-implement of the official efficientdet with SOTA performance in real time and pretrained weights.
GNU Lesser General Public License v3.0
5.2k stars 1.27k forks source link

How to train the d0 on coco_human_data ? (only for person detection) #219

Open xscjun opened 4 years ago

xscjun commented 4 years ago

Thanks for your share of the great work. I evaluate the d0 on the coco_human_val ,and get map : 0.432. When I trained the data with the pre-trained model (efficientdet-d0.pth) , after 100 epoch ,only get the map 0.342,and the loss is no longer drop .

I trained with the script first: 
python train.py -c 0 --batch_size 512 --lr 1e-2 --num_workers 24 
        --num_epochs 500  --load_weights efficientdet-d0.pth

From epoch34,the learning rate drop to 1e-3 automatically,   
From epoch 59 ,the loss is no longer drop .then  I changed the lr to 1e-4,  but the loss is still  no longger drop(now 100epoch but still no dropping) 。

How can I change the Hyperparameter, to  get a better loss graph and map  ? 
change adamw to sgd ? drop the lr ? other parameter ?
xscjun commented 4 years ago

I have read from other issue " training on coco takes time and requires you to change parameters frequently. " Can you share you training parameters and how to change them during the training,please ?

zylo117 commented 4 years ago

You should train with --head_only, and reduce lr. You can also monitor loss graph in tensorboard. If your mAP drops, it's very likely that you are suffering overfitting

xscjun commented 4 years ago

@zylo117 Yes ,I can reach i higher map(0.411) with --head_only. I just want to know how to try train the backbone . my loss graph : (I think it's overfitting from 48k ) loss_graph

Second time I change the lr to 1e-4 when 48k , and the loss graph like that :

loss_graph3

How should I change the parameters ,please ?

zylo117 commented 4 years ago

backbone training is not necessary unless no matter what you do, the mAP can't get any higher.

but, I think by reducing lr, the mAP can be a little bit higher.

Person is one of the hard objects in Coco, so 0.411 is high enough for d0.

xscjun commented 4 years ago

@zylo117 Thank you for your reply, I change the lr to 1e-3,
train from the weight you provided,efficientdet-d0.pth After 17epoch , the map : 0.409, then , the loss is no longer drop.

I wander , If I train the model on another dataset(only for person ,100000-bboxes),should I freeze the backbone ?

zylo117 commented 4 years ago

Why did you increase lr instead of reducing? And always freeze backbone first.