A small example package for face recognition
Project description
Retinaface
A simple package of face detection
This package is built on top of the Retinaface
-
[How to do a python package ](#How to do a python package)
More about Retinaface
Retinaface is the State-of-the-art for Face Detection on WIDER Face. There are two versions of retinaface: MobileNet Backend and Resnet Backend. The model using MobileNet as backbone has only 1.7M, the other model with Resnet backbone has ~30m. Here is the performance on the FDDB dataset:
FDDB(pytorch) | performance |
---|---|
Mobilenet0.25 | 98.64% |
Resnet50 | 99.22% |
Installation
$ pip install pytorch-detection
Usage
from retinaface import RetinafaceDetector
import cv2 as cv
### Mobinet backbone
detector = RetinafaceDetector(net='mnet').detect_faces
img = cv.imread('./imgs/DSC_8221.jpg')
bounding_boxes, landmarks = detector(img)
print(bounding_boxes)
### Resnet backbone
detector = RetinafaceDetector(net='mnet').detect_faces
img = cv.imread('./imgs/DSC_8221.jpg')
bounding_boxes, landmarks = detector(img)
print(bounding_boxes)
Result
How to make a python package
To create this project locally, create the following file structure:
retinaface
├── retinaface
│ ├── __init__.py
├── LICENSE
├── README.md
├── setup.py
├── setup.py
├── requirements.txt
Creating setup.py
setup.py is the build script for setuptools. It tells setuptools about your package
import setuptools
setuptools.setup(
name="Pytorch-detection", # Replace with your own username
version="0.0.1",
author="Hoang Phuong",
author_email="hphuongdhsp@gmail.com",
license='MIT',
description = "A simple example package for face detection",
long_description = long_description,
long_description_content_type="text/markdown",
url="https://github.com/hphuongdhsp/retinaface",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
keywords='face detection, retinaface',
install_requires=open('requirements.txt').readlines(),
python_requires='>=3.6',
)
Creating README.md
Creating a LICENSE
Generating distribution archives
Install setuptools and wheel
$ pip install --user --upgrade setuptools wheel
make distribution files:
python3 setup.py sdist bdist_wheel
That command genetate two files in the dist directory:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file Pytorch-detection-0.0.1.tar.gz
.
File metadata
- Download URL: Pytorch-detection-0.0.1.tar.gz
- Upload date:
- Size: 15.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.6.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2abbe9b33e1abb49cc1e66a96733ad837ebbba5757076bc9d6e35970b74183f7 |
|
MD5 | 27e61b7c48ce7389a29eba25d35f7486 |
|
BLAKE2b-256 | e078c114676d9260900eee90b70b0eeb88b722c8cf6056d9de971b393d426591 |
File details
Details for the file Pytorch_detection-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: Pytorch_detection-0.0.1-py3-none-any.whl
- Upload date:
- Size: 20.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.6.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1e774d72a149420f674c8af2bd1e658811c4b4fb412d4b5e73ab5b0911382ab |
|
MD5 | 0b5888e918698118b784935c9ca6d8de |
|
BLAKE2b-256 | b8267208e0b348dfe2d7cd54bdf02bfb04be6ece79023cf4160c36119b9a1808 |