RetinaDetector是基于RetinaFace修改的检测方法,原论文is a practical single-stage SOTA face detector which is initially described in arXiv technical report
- Organise the dataset directory as follows:
data/retinaface/
train/
images/
label.txt
val/
images/
label.txt
test/
images/
label.txt
- Install MXNet with GPU support.
- Install Deformable Convolution V2 operator from Deformable-ConvNets if you use the DCN based backbone.
- Type
make
to build cxx tools.
Please check train.py
for training.
- Copy
rcnn/sample_config.py
torcnn/config.py
为了获得更好的训练效果,可针对性的修改一些参数,如下:
config.TRAIN.MIN_BOX_SIZE = 10 #最小bbox
config.FACE_LANDMARK = False #使用landmark
config.USE_BLUR = False
config.BBOX_MASK_THRESH = 0
config.COLOR_MODE = 2 #增强
config.COLOR_JITTERING = 0.125
无效人脸的过滤,如下:
if (x2 - x1) < config.TRAIN.MIN_BOX_SIZE or (y2 - y1) < config.TRAIN.MIN_BOX_SIZE:
continue
if self._split.startswith('train'):
blur[ix] = values[19]
if blur[ix] < 0.25:
continue
if config.BBOX_MASK_THRESH > 0:
if (x2 - x1) < config.BBOX_MASK_THRESH or (y2 - y1) < config.BBOX_MASK_THRESH:
boxes_mask.append(np.array([x1, y1, x2, y2], np.float))
continue
if self._split.startswith('train'):
if blur[ix] < 0.35:
boxes_mask.append(np.array([x1, y1, x2, y2], np.float))
continue
-
Download pretrained models and put them into
model/
.ImageNet ResNet50 (baidu cloud and dropbox).
ImageNet ResNet152 (baidu cloud and dropbox).
-
Start training with
sh train_model.sh
.
Before training, you can check theresnet
network configuration (e.g. pretrained model path, anchor setting and learning rate policy etc..) inrcnn/config.py
.
Please check test.py
for testing.
- 缺陷检测
- 人脸检测+人脸对齐
人脸检测模型,比原版误检更低,角度较大和模糊超过0.6的face会自动忽略,更适合人脸识别的应用:click here.
由于缺陷检测数据涉及私密性,缺陷检测的模型暂时不会释放
@inproceedings{[email protected],
year={2019}
}