Media-Smart / vedadet

A single stage object detection toolbox based on PyTorch
Apache License 2.0
498 stars 128 forks source link

Face detection #34

Closed chenzhengnan closed 3 years ago

chenzhengnan commented 3 years ago

Thank you for your hard work, before run infer.py,it need us modify some configuration accordingly in the config file like configs/infer/retinanet/retinanet.py,What are these parameters?just change the num_classes ande classes_names?Looking forward to your reply。

mike112223 commented 3 years ago

Hi, Actually, you only need to change the "weights", the "filepath" where you save your trained model. And others like "num_classes" and "class_names" are based on your dataset. Besides, some post process parameters like "score_thr", "max_per_img" and "iou_thr" in "infer_engine" are based on your needs.

chenzhengnan commented 3 years ago

Hi, Actually, you only need to change the "weights", the "filepath" where you save your trained model. And others like "num_classes" and "class_names" are based on your dataset. Besides, some post process parameters like "score_thr", "max_per_img" and "iou_thr" in "infer_engine" are based on your needs.

thank you for your reply, however,When I change ‘configs/infer/retinanet/retinanet.py’ to ‘configs/infer/tinaface/tinaface.py’, I can run infer.py successfully. Does this command need to be adjusted?【CUDA_VISIBLE_DEVICES="0" python tools/infer.py configs/infer/retinanet/retinanet.py image_path】 thank you

mike112223 commented 3 years ago

You mean that you will get error when running "CUDA_VISIBLE_DEVICES="0" python tools/infer.py configs/infer/retinanet/retinanet.py image_path". Please provide the error info.

chenzhengnan commented 3 years ago

You mean that you will get error when running "CUDA_VISIBLE_DEVICES="0" python tools/infer.py configs/infer/retinanet/retinanet.py image_path". Please provide the error info.

Some of them are as follows: The model and loaded state dict do not match exactly

size mismatch for bbox_head.retina_cls.weight: copying a param with shape torch.Size([3, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([9, 256, 3, 3]). size mismatch for bbox_head.retina_cls.bias: copying a param with shape torch.Size([3]) from checkpoint, the shape in current model is torch.Size([9]). size mismatch for bbox_head.retina_reg.weight: copying a param with shape torch.Size([12, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([36, 256, 3, 3]). size mismatch for bbox_head.retina_reg.bias: copying a param with shape torch.Size([12]) from checkpoint, the shape in current model is torch.Size([36]). unexpected key in source state_dict: backbone.gn1.weight, backbone.gn1.bias, backbone.layer1.0.gn1.weight, backbone.layer1.0.gn1.bias, backbone.layer1.0.gn2.weight, backbone.layer1.0.gn2.bias, backbone.layer1.0.gn3.weight, backbone.layer1.0.gn3.bias, backbone.layer1.1.gn1.weight, backbone.layer1.1.gn1.bias, backbone.layer1.1.gn2.weight, backbone.layer1.1.gn2.bias, backbone.layer1.1.gn3.weight, backbone.layer1.1.gn3.bias, backbone.layer1.2.gn1.weight, backbone.layer1.2.gn1.bias, backbone.layer1.2.gn2.weight, backbone.layer1.2.gn2.bias, backbone.layer1.2.gn3.weight, backbone.layer1.2.gn3.bias, backbone.layer2.0.gn1.weight, backbone.layer2.0.gn1.bias, backbone.layer2.0.gn2.weight, backbone.layer2.0.gn2.bias, backbone.layer2.0.gn3.weight, backbone.layer2.0.gn3.bias, backbone.layer2.1.gn1.weight, backbone.layer2.1.gn1.bias, backbone.layer2.1.gn2.weight, backbone.layer2.1.gn2.bias, backbone.layer2.1.gn3.weight, backbone.layer2.1.gn3.bias, backbone.layer2.2.gn1.weight, backbone.layer2.2.gn1.bias, backbone.layer2.2.gn2.weight, backbone.layer2.2.gn2.bias, backbone.layer2.2.gn3.weight, backbone.layer2.2.gn3.bias, backbone.layer2.3.gn1.weight, backbone.layer2.3.gn1.bias, backbone.layer2.3.gn2.weight, backbone.layer2.3.gn2.bias, backbone.layer2.3.gn3.weight, backbone.layer2.3.gn3.bias, backbone.layer3.0.gn1.weight, backbone.layer3.0.gn1.bias, backbone.layer3.0.gn2.weight, backbone.layer3.0.gn2.bias, backbone.layer3.0.gn3.weight, backbone.layer3.0.gn3.bias, backbone.layer3.0.conv2.conv_offset.weight, backbone.layer3.0.conv2.conv_offset.bias, backbone.layer3.1.gn1.weight, backbone.layer3.1.gn1.bias, backbone.layer3.1.gn2.weight, backbone.layer3.1.gn2.bias, backbone.layer3.1.gn3.weight, backbone.layer3.1.gn3.bias, backbone.layer3.1.conv2.conv_offset.weight, backbone.layer3.1.conv2.conv_offset.bias, backbone.layer3.2.gn1.weight, backbone.layer3.2.gn1.bias, backbone.layer3.2.gn2.weight, backbone.layer3.2.gn2.bias, backbone.layer3.2.gn3.weight, backbone.layer3.2.gn3.bias, backbone.layer3.2.conv2.conv_offset.weight, backbone.layer3.2.conv2.conv_offset.bias, backbone.layer3.3.gn1.weight, backbone.layer3.3.gn1.bias, backbone.layer3.3.gn2.weight, backbone.layer3.3.gn2.bias, backbone.layer3.3.gn3.weight, backbone.layer3.3.gn3.bias, backbone.layer3.3.conv2.conv_offset.weight, backbone.layer3.3.conv2.conv_offset.bias, backbone.layer3.4.gn1.weight, backbone.layer3.4.gn1.bias, backbone.layer3.4.gn2.weight, backbone.layer3.4.gn2.bias, backbone.layer3.4.gn3.weight, backbone.layer3.4.gn3.bias, backbone.layer3.4.conv2.conv_offset.weight, backbone.layer3.4.conv2.conv_offset.bias, backbone.layer3.5.gn1.weight, backbone.layer3.5.gn1.bias, backbone.layer3.5.gn2.weight, backbone.layer3.5.gn2.bias, backbone.layer3.5.gn3.weight, backbone.layer3.5.gn3.bias, backbone.layer3.5.conv2.conv_offset.weight, backbone.layer3.5.conv2.conv_offset.bias, backbone.layer4.0.gn1.weight, backbone.layer4.0.gn1.bias, backbone.layer4.0.gn2.weight, backbone.layer4.0.gn2.bias, backbone.layer4.0.gn3.weight, backbone.layer4.0.gn3.bias, backbone.layer4.0.conv2.conv_offset.weight, backbone.layer4.0.conv2.conv_offset.bias, backbone.layer4.1.gn1.weight, backbone.layer4.1.gn1.bias, backbone.layer4.1.gn2.weight, backbone.layer4.1.gn2.bias, backbone.layer4.1.gn3.weight, backbone.layer4.1.gn3.bias, backbone.layer4.1.conv2.conv_offset.weight, backbone.layer4.1.conv2.conv_offset.bias, backbone.layer4.2.gn1.weight, backbone.layer4.2.gn1.bias, backbone.layer4.2.gn2.weight, backbone.layer4.2.gn2.bias, backbone.layer4.2.gn3.weight, backbone.layer4.2.gn3.bias, backbone.layer4.2.conv2.conv_offset.weight, backbone.layer4.2.conv2.conv_offset.bias, neck.0.lateral_convs.0.conv.weight, neck.0.lateral_convs.0.gn.weight, neck.0.lateral_convs.0.gn.bias, neck.0.lateral_convs.1.conv.weight, neck.0.lateral_convs.1.gn.weight, neck.0.lateral_convs.1.gn.bias, neck.0.lateral_convs.2.conv.weight, neck.0.lateral_convs.2.gn.weight, neck.0.lateral_convs.2.gn.bias, neck.0.lateral_convs.3.conv.weight, neck.0.lateral_convs.3.gn.weight, neck.0.lateral_convs.3.gn.bias, neck.0.fpn_convs.0.conv.weight, neck.0.fpn_convs.0.gn.weight, neck.0.fpn_convs.0.gn.bias, neck.0.fpn_convs.1.conv.weight, neck.0.fpn_convs.1.gn.weight, neck.0.fpn_convs.1.gn.bias, neck.0.fpn_convs.2.conv.weight, neck.0.fpn_convs.2.gn.weight, neck.0.fpn_convs.2.gn.bias, neck.0.fpn_convs.3.conv.weight, neck.0.fpn_convs.3.gn.weight, neck.0.fpn_convs.3.gn.bias, neck.0.fpn_convs.4.conv.weight, neck.0.fpn_convs.4.gn.weight, neck.0.fpn_convs.4.gn.bias, neck.0.fpn_convs.5.conv.weight, neck.0.fpn_convs.5.gn.weight, neck.0.fpn_convs.5.gn.bias, neck.1.level_convs.0.0.conv.weight, neck.1.level_convs.0.0.gn.weight, neck.1.level_convs.0.0.gn.bias, neck.1.level_convs.0.1.conv.weight, neck.1.level_convs.0.1.gn.weight, neck.1.level_convs.0.1.gn.bias, neck.1.level_convs.0.2.conv.weight, neck.1.level_convs.0.2.gn.weight, neck.1.level_convs.0.2.gn.bias, neck.1.level_convs.0.3.conv.weight, neck.1.level_convs.0.3.gn.weight, neck.1.level_convs.0.3.gn.bias, neck.1.level_convs.0.4.conv.weight, neck.1.level_convs.0.4.gn.weight, neck.1.level_convs.0.4.gn.bias, bbox_head.retina_iou.weight, bbox_head.retina_iou.bias, bbox_head.cls_convs.0.gn.weight, bbox_head.cls_convs.0.gn.bias, bbox_head.cls_convs.1.gn.weight, bbox_head.cls_convs.1.gn.bias, bbox_head.cls_convs.2.gn.weight, bbox_head.cls_convs.2.gn.bias, bbox_head.cls_convs.3.gn.weight, bbox_head.cls_convs.3.gn.bias, bbox_head.reg_convs.0.gn.weight, bbox_head.reg_convs.0.gn.bias, bbox_head.reg_convs.1.gn.weight, bbox_head.reg_convs.1.gn.bias, bbox_head.reg_convs.2.gn.weight, bbox_head.reg_convs.2.gn.bias, bbox_head.reg_convs.3.gn.weight, bbox_head.reg_convs.3.gn.bias

mike112223 commented 3 years ago

Trained TinaFace model can not be loaded into RetinaNet, cause they are different models. If you want to use some models to infer, you should first train a corresponding model.

chenzhengnan commented 3 years ago

Trained TinaFace model can not be loaded into RetinaNet, cause they are different models. If you want to use some models to infer, you should first train a corresponding model.

ok , i get it, Is there any solution to the false face detection?