ternaus/retinaface

Validation accuracy & Mobilenet

JohannesTK opened this issue ยท 9 comments

Hi,

Thank you for the rewrite and very intuitive repo.

Have you reported validation accuracy for the Resnet50 and have you also implemented mobilenet?

Thanks,
Johannes

I did not.

It is not that hard to add the whole set of backbones from https://github.com/rwightman/pytorch-image-models/blob/master/results/results-imagenet.csv but I do not really need it right now, hence I cannot tell when this functionality will be added.

Thanks for a quick response and well understood regards mobilenet.

Regards the Resnet50 val accuracy, is it the same as reported in https://github.com/biubug6/Pytorch_Retinaface#widerface-val-performance-in-single-scale-when-using-resnet50-as-backbone-net or do you have some numbers for that?

tloki commented

I doubt it is the same since @ternaus did train his own model.

A validation accuracy (and other numbers) would be nice just to compare to the baseline retinaface.

For information, there is also another project called FaceXLib with RetinaFace for detection.

FaceXlib

The Python package is available on PyPI:

pip install facexlib

As shown in the following code:

https://github.com/xinntao/facexlib/blob/45fee8e7885fc462d2d4c4eafb2650ff384b89c8/facexlib/detection/__init__.py#L8-L16

The model checkpoints are downloaded from here:

FaceXLib weights

https://github.com/xinntao/facexlib/releases/tag/v0.1.0

They use the same name convention as the original model checkpoints, so I wonder if these are direct copies without re-training.
Edit: See my following post, the answer is yes.

https://github.com/biubug6/Pytorch_Retinaface#training

Original weights

I have run the following code on a Google Colab machine:

!wget https://github.com/xinntao/facexlib/releases/download/v0.1.0/detection_mobilenet0.25_Final.pth
!wget https://github.com/xinntao/facexlib/releases/download/v0.1.0/detection_Resnet50_Final.pth

!gdown --id 15zP8BP-5IvWXWZoYTNdvUJUiBqZ1hxu1
!gdown --id 14KX6VqF69MdSPk3Tr9PlDYbq7ArpdNUW
!sha256sum *.pth

This is the output:

2979b33ffafda5d74b6948cd7a5b9a7a62f62b949cef24e95fd15d2883a65220  detection_mobilenet0.25_Final.pth
6d1de9c2944f2ccddca5f5e010ea5ae64a39845a86311af6fdf30841b0a5a16d  detection_Resnet50_Final.pth
2979b33ffafda5d74b6948cd7a5b9a7a62f62b949cef24e95fd15d2883a65220  mobilenet0.25_Final.pth
6d1de9c2944f2ccddca5f5e010ea5ae64a39845a86311af6fdf30841b0a5a16d  Resnet50_Final.pth

So the model checkpoints should be the same.

--

If you don't have access to sha256sum on your system (maybe Windows), you can do it in Python:

# Reference: https://stackoverflow.com/a/44873382/376454

import hashlib

def sha256sum(filename):
    h  = hashlib.sha256()
    b  = bytearray(128*1024)
    mv = memoryview(b)
    with open(filename, 'rb', buffering=0) as f:
        for n in iter(lambda : f.readinto(mv), 0):
            h.update(mv[:n])
    return h.hexdigest()
import glob

for fname in glob.glob('*.pth'):
  print(f'{sha256sum(fname)} {fname}')

This is the output (same as above):

2979b33ffafda5d74b6948cd7a5b9a7a62f62b949cef24e95fd15d2883a65220 mobilenet0.25_Final.pth
6d1de9c2944f2ccddca5f5e010ea5ae64a39845a86311af6fdf30841b0a5a16d detection_Resnet50_Final.pth
2979b33ffafda5d74b6948cd7a5b9a7a62f62b949cef24e95fd15d2883a65220 detection_mobilenet0.25_Final.pth
6d1de9c2944f2ccddca5f5e010ea5ae64a39845a86311af6fdf30841b0a5a16d Resnet50_Final.pth
tloki commented

How does this have anything to do with this repo? If I understood you right - your claim is that FaceXLib uses same weights as biubug6 (original retinaface repo?). On FaceXLib it is even stated (README) that they do use biubug6 model/code...

How does this have anything to do with this repo?

It is additional information for users like myself who:

  • have used this repository in the past,
  • would like to have validation accuracy for the model checkpoints which they use.

FaceXLib is an alternative which:

  • did not exist when this repository was created,
  • is installable with pip and just as easy to use as this repository,
  • relies on the original weights, for which accuracy is documented.
tloki commented

The reason I was actually interested in this repo was - NMS. biubug6 uses its own implementation, which is slow (it could somewhat easily be parallelized), and this one uses off-the shelf NMS which seems like a less of bottleneck. I'm mainly refereing to for loop which does NMS for every element in batch.

I see. It looks like this repository relies on:

wile FaceXLib relies on:

I'm mainly referring to for loop which does NMS for every element in batch.

Maybe I misunderstood and you are referring to another part of the code than the one which I mentioned.