SthPhoenix / InsightFace-REST

InsightFace REST API for easy deployment of face recognition services with TensorRT in Docker.
Apache License 2.0
486 stars 118 forks source link

Can I request torch model files (scrfd_10g_gnkps)? #103

Open markdchoung opened 1 year ago

markdchoung commented 1 year ago

I was confirmed that the same problem occurred when a model using batch normalization was used. Thanks for solving the problem by using group normalization!

  1. I need torch model files to use batch inference and utilize multi-gpu environment. Would you give me torch model files? Especially, I need scrfd_10g_gnkps. or if you have scrfd_34g_gnkps, that would be very helpful for me!

  2. And I completed to reproduce the general SCRFD model, and I am looking for a tutorial on how to reproduce gnkps model (or bnkps). Can you give me that information?

  3. Is there any way to perform batch inference with onnx model(scrfd_10g_gnkps) that you are providing?

SthPhoenix commented 1 year ago

Hi! I'm not sure If i'll be able to find raw torch checkpoints, but:

  1. This repo provides batch processing using TensorRT, multiple GPU can be utilized by running multiple API instances behind load balancer.
  2. You can uncomment this line of default config and comment line 190, and that's it )
  3. In this repo batch inference is supported using NVIDIA TensorRT backend, ONNX backend might be modified for this task too, but I recall there were some issues with batch inference on CPU, and in this repo onnxruntime is used mostly as fallback for CPU inference where GPU is not availiable.
markdchoung commented 1 year ago

Thanks @SthPhoenix ! I have reproduced scrd_10gf_gnkps and scrd_32gf_gnkps with training codes from insightface. Validation results on tensorboard were good enough (torch model), but the performance sharply dropped after convering into onnx. I used onnx conversion script from insightface without any changes. You released 10gf_gnkps model, and how did you convert trained torch model into onnx model?

SthPhoenix commented 1 year ago

Hi! I have used exactly the same script from insightface repo.

markdchoung commented 1 year ago

Hi! I have used exactly the same script from insightface repo.

I followed your guide to train GNKPS models, but the model performance cannot be reproduced. The model performed well on widerface validation dataset, but it performed poorly on images with large faces.

Did you train with the following configuration?

norm_cfg=dict(type='GN', num_groups=16, requires_grad=True), cls_reg_share=True, strides_share=False,

Did you train the model without any other additional methods? Then, the trained model perform well on large faces? How many gpu did you use? The total batch size will vary depending on the number of gpu, could this also affect the performance? I used 8 gpus for training.

SthPhoenix commented 1 year ago

Hi! Yes, I have used this config, I have trained models on single GPU, some on rtx2080, some on rtx3090. I can't recall if I have changed batch size, but I have trained models a bit longer than 640 epoch, something around 720-760 epochs to reach peak accuracy. Also I have tried training 34g model, and I wasn't able to solve large faces problem for this model - it still wasn't able to detect them. Now I'm using mainly yolov5-face models for detection - since they performs better in most cases, and don't suffer from this bug.