SFD implement with pytorch

Overview

S³FD: Single Shot Scale-invariant Face Detector

A PyTorch Implementation of Single Shot Scale-invariant Face Detector

Description

Meanwhile train hand and head with S3FD,hand dataset is Egohands Dataset,head dataset is SCUT-HEAD,we can download hand model and face model

Requirement

  • pytorch 0.3
  • opencv
  • numpy
  • easydict

Prepare data

  1. download WIDER face dataset、Egohands dataset and SCUT-HEAD
  2. modify data/config.py
  3. python prepare_wider_data.py 4 python prepare_handataset.py

Train

We can choose different dataset to train different target[face,head,hand]

python train.py --batch_size 4 --dataset face\hand\head

Evalution

according to yourself dataset path,modify data/config.py

  1. Evaluate on AFW.
python afw_test.py
  1. Evaluate on FDDB
python fddb_test.py
  1. Evaluate on PASCAL face
python pascal_test.py
  1. test on WIDER FACE
python wider_test.py

Demo

you can test yourself image

python demo.py

Result

  1. AFW PASCAL FDDB
afw pascal fddb
AFW AP=99.81 paper=99.85 
PASCAL AP=98.77 paper=98.49
FDDB AP=0.975 paper=0.983
WIDER FACE:
Easy AP=0.925 paper = 0.927
Medium AP=0.925 paper = 0.924
Hard AP=0.854 paper = 0.852
  1. demo
afw

References

Comments
  • Questions about facemodel

    Questions about facemodel

    Hi, I have downloaded your ''face model'' which is provided in README, and successfully run it on my machine. But now I still have some questions because it seems works well on faces but not work well on heads. Here is my question: Is the "face model" trained with both head dataset "SCUT-HEAD" and face dataset "widerface", or just only trained with face dataset "widerface"?

    opened by piddnad 12
  • Downloading checkpoints

    Downloading checkpoints

    I am finding it real hard to download checkpoint files from the website you uploaded in as I do not understand Chinese. Is there any other way you can share them? Much appreciated. Thanks.

    opened by sushil-bharati 6
  • How to solve these problems in MATLAB when I plot the curves ?

    How to solve these problems in MATLAB when I plot the curves ?

    I ran wider_test.py and got a folder —— s3fd_val in eval_tools. Then I ran wider_eval.m in MATLAB, but some errors were reported.


    错误使用 legend (line 273) 未知的属性 'show'

    出错 plot_pr (line 22) legend1 = legend(lendge_name,'show');

    出错 wider_plot (line 33) plot_pr(propose, recall, name_list, seting_class, set_list{i},dateset_class);

    出错 wider_eval (line 35) wider_plot(setting_name_list,dir_int,seting_class,dateset_class);


    opened by sagittahjz 2
  •  Testing time is 0.5 seconds per frame using GeForce RTX 3080

    Testing time is 0.5 seconds per frame using GeForce RTX 3080

    Hi, thank you very much for your open source code. However, I run the 'demo.py' and find the running on one frame using RTX 3080 is about 0.5 seconds. The original paper claimed this method is real-time.

    Could you please give me some advice on this?

    opened by zkxwy1996 0
  • a bug in nms

    a bug in nms

    def nms(boxes, scores, overlap=0.5, top_k=200): keep = scores.new(scores.size(0)).zero_().long() if boxes.numel() == 0: return keep x1 = boxes[:, 0] y1 = boxes[:, 1] x2 = boxes[:, 2] y2 = boxes[:, 3] area = torch.mul(x2 - x1, y2 - y1) v, idx = scores.sort(0) # sort in ascending order # I = I[v >= 0.01] idx = idx[-top_k:] # indices of the top-k largest vals xx1 = boxes.new() yy1 = boxes.new() xx2 = boxes.new() yy2 = boxes.new() w = boxes.new() h = boxes.new()

    # keep = torch.Tensor()
    count = 0
    while idx.numel() > 0:
        i = idx[-1]  # index of current largest val
        # keep.append(i)
        keep[count] = i
        count += 1
        if idx.size(0) == 1:
            break
        idx = idx[:-1]  # remove kept element from view
        # load bboxes of next highest vals
        torch.index_select(x1, 0, idx, out=xx1)
        torch.index_select(y1, 0, idx, out=yy1)
        torch.index_select(x2, 0, idx, out=xx2)
        torch.index_select(y2, 0, idx, out=yy2)
        # store element-wise max with next highest score
        xx1 = torch.clamp(xx1, min=x1[i])
        yy1 = torch.clamp(yy1, min=y1[i])
        xx2 = torch.clamp(xx2, max=x2[i])
        yy2 = torch.clamp(yy2, max=y2[i])
        w.resize_as_(xx2)
        h.resize_as_(yy2)
        w = xx2 - xx1
        h = yy2 - yy1
        # check sizes of xx1 and xx2.. after each iteration
        w = torch.clamp(w, min=0.0)
        h = torch.clamp(h, min=0.0)
        inter = w * h
        # IoU = i / (area(a) + area(b) - i)
        rem_areas = torch.index_select(area, 0, idx)  # load remaining areas)
        union = (rem_areas - inter) + area[i]
        IoU = inter / union  # store result in iou
        # keep only elements with an IoU <= overlap
        idx = idx[IoU.le(overlap)]
    **_return keep, count_**
    

    the two return are not same ,it may take error: layers/functions/detection.py", line 67, in forward ValueError: not enough values to unpack (expected 2, got 0)

    opened by njustymk 2
  • Looking for pretrained weight s3fd.pth in demo.py and base weight vgg16_reducedfc.pth in train.py

    Looking for pretrained weight s3fd.pth in demo.py and base weight vgg16_reducedfc.pth in train.py

    Hi, Could you please provide the pretrained weight file for demo.py, so that I can test it on any image? Also the basenet vgg16_reducedfc.pth for training? Thanks.

    opened by sabrinatuli 0
  • multibox loss

    multibox loss

    Thanks for your code in the paper

    • the cls loss is normalized by the number of positive and negative anchors
    • the reg term is normalized by the number of positive anchors. so may be image it should be changed
    M = num_pos.data.sum().float() + num_neg.data.sum().float()
    loss_c /= N
    

    also in the paper L =\lambda * L_{cls} + L_{reg} in the code

    loss_l, loss_c = criterion(out, targets)
    loss = loss_l + loss_c
    

    may be the two place should be modified

    opened by XDUSPONGE 0
  • Consumption of memory is increasing while running the code

    Consumption of memory is increasing while running the code

    Whenever i am passing the images to the model,the memory consumption of RAM is increasing heavily. So is there any way to reduce it? or else this model itself need more configurations?

    Thanks in advance.

    opened by devendraswamy 0
Owner
Jun Li
to be a different person
Jun Li
Official pytorch implement for “Transformer-Based Source-Free Domain Adaptation”

Official implementation for TransDA Official pytorch implement for “Transformer-Based Source-Free Domain Adaptation”. Overview: Result: Prerequisites:

stanley 54 Dec 22, 2022
A Marvelous ChatBot implement using PyTorch.

PyTorch Marvelous ChatBot [Update] it's 2019 now, previously model can not catch up state-of-art now. So we just move towards the future a transformer

JinTian 223 Oct 18, 2022
a Pytorch easy re-implement of "YOLOX: Exceeding YOLO Series in 2021"

A pytorch easy re-implement of "YOLOX: Exceeding YOLO Series in 2021" 1. Notes This is a pytorch easy re-implement of "YOLOX: Exceeding YOLO Series in

null 91 Dec 26, 2022
PyTorch Implement of Context Encoders: Feature Learning by Inpainting

Context Encoders: Feature Learning by Inpainting This is the Pytorch implement of CVPR 2016 paper on Context Encoders 1) Semantic Inpainting Demo Inst

null 321 Dec 25, 2022
Implement Decoupled Neural Interfaces using Synthetic Gradients in Pytorch

disclaimer: this code is modified from pytorch-tutorial Image classification with synthetic gradient in Pytorch I implement the Decoupled Neural Inter

Andrew 114 Dec 22, 2022
A Pytorch implement of paper "Anomaly detection in dynamic graphs via transformer" (TADDY).

TADDY: Anomaly detection in dynamic graphs via transformer This repo covers an reference implementation for the paper "Anomaly detection in dynamic gr

Yue Tan 21 Nov 24, 2022
Using pytorch to implement unet network for liver image segmentation.

Using pytorch to implement unet network for liver image segmentation.

zxq 1 Dec 17, 2021
Implement of homography net by pytorch

HomographyNet Implement of homography net by pytorch Brief Introduction This project is based on the work Homography-Net: @article{detone2016deep, t

ronghao_CN 4 May 19, 2022
Implement of "Training deep neural networks via direct loss minimization" in PyTorch for 0-1 loss

This is the implementation of "Training deep neural networks via direct loss minimization" published at ICML 2016 in PyTorch. The implementation targe

Cuong Nguyen 1 Jan 18, 2022
Unofficial pytorch-lightning implement of Mip-NeRF

mipnerf_pl Unofficial pytorch-lightning implement of Mip-NeRF, Here are some results generated by this repository (pre-trained models are provided bel

Jianxin Huang 159 Dec 23, 2022
This repository is related to an Arabic tutorial, within the tutorial we discuss the common data structure and algorithms and their worst and best case for each, then implement the code using Python.

Data Structure and Algorithms with Python This repository is related to the Arabic tutorial here, within the tutorial we discuss the common data struc

Mohamed Ayman 33 Dec 2, 2022
Implement face detection, and age and gender classification, and emotion classification.

YOLO Keras Face Detection Implement Face detection, and Age and Gender Classification, and Emotion Classification. (image from wider face dataset) Ove

Chloe 10 Nov 14, 2022
offical implement of our Lifelong Person Re-Identification via Adaptive Knowledge Accumulation in CVPR2021

LifelongReID Offical implementation of our Lifelong Person Re-Identification via Adaptive Knowledge Accumulation in CVPR2021 by Nan Pu, Wei Chen, Yu L

PeterPu 76 Dec 8, 2022
Official implement of Paper:A deeply supervised image fusion network for change detection in high resolution bi-temporal remote sening images

A deeply supervised image fusion network for change detection in high resolution bi-temporal remote sensing images 深度监督影像融合网络DSIFN用于高分辨率双时相遥感影像变化检测 Of

Chenxiao Zhang 135 Dec 19, 2022
Official implement of "CAT: Cross Attention in Vision Transformer".

CAT: Cross Attention in Vision Transformer This is official implement of "CAT: Cross Attention in Vision Transformer". Abstract Since Transformer has

null 100 Dec 15, 2022
Official Implement of CVPR 2021 paper “Cross-Modal Collaborative Representation Learning and a Large-Scale RGBT Benchmark for Crowd Counting”

RGBT Crowd Counting Lingbo Liu, Jiaqi Chen, Hefeng Wu, Guanbin Li, Chenglong Li, Liang Lin. "Cross-Modal Collaborative Representation Learning and a L

null 37 Dec 8, 2022
Implement A3C for Mujoco gym envs

pytorch-a3c-mujoco Disclaimer: my implementation right now is unstable (you ca refer to the learning curve below), I'm not sure if it's my problems. A

Andrew 70 Dec 12, 2022
Perfect implement. Model shared. x0.5 (Top1:60.646) and 1.0x (Top1:69.402).

Shufflenet-v2-Pytorch Introduction This is a Pytorch implementation of faceplusplus's ShuffleNet-v2. For details, please read the following papers:

null 423 Dec 7, 2022
implement of SwiftNet:Real-time Video Object Segmentation

SwiftNet The official PyTorch implementation of SwiftNet:Real-time Video Object Segmentation, which has been accepted by CVPR2021. Requirements Python

haochen wang 64 Dec 14, 2022