StanislasBertrand / RetinaFace-tf2

RetinaFace (RetinaFace: Single-stage Dense Face Localisation in the Wild, published in 2019) reimplemented in Tensorflow 2.0, with pretrained weights available !
MIT License
258 stars 21 forks source link

what does the setup.py file do? #4

Closed wulikai1993 closed 4 years ago

wulikai1993 commented 4 years ago

Thanks in advance!

StanislasBertrand commented 4 years ago

The setup.py in the WiderFace-Evalutation/ folder is used to build the WiderFace-Evaluation package when we run python setup.py build_ext --inplace (see "evaluate on widerface" part of the ReadMe)

In general, for more information about setup.py files, you can check the officiel python packaging documentation : https://packaging.python.org/tutorials/packaging-projects/

wulikai1993 commented 4 years ago

Sorry for my unclear question. I mean the setup.py in rcnn/cython which is used in Makefile. I think it is related to cpu or gpu devices. But why we write this part of codes? Does not the tf2 handle the devices automatically?

StanislasBertrand commented 4 years ago

The rcnn module is used to run non maximal suppression (or "nms") on the outputs of the neural network, which is in tf2. Sometimes the neural network will output 2 boxes for 1 face. The nms step is here to find and delete duplicates.

So the setup.py is here to build this component on your machine. it builds a GPU version of nms, and also a CPU version if you dont have a gpu available. In this case you should change the "use_gpu_nms" of the RetinaFace object constructor.

Hope that clears it up !