DeepNipple is an algorithm that detects the areola and nipple with very high precision. The core is a convolutional neural network that solves a typical AI segmentation problem. This novel dataset and algorithm are the state-of-the-art in nipple detection and can be used for real-world applications such as criminal identification.
I am sure that github's community can take the best from this repo, and inspire other creative tools.
DeepNipple innovates in nipple detection by rethinking the problem as a segmentation problem comprising of two categories: areola and nipple. It is also possible to extract the areola and nipple in a bounding box as if it was an object detection problem.
DeepNipple dataset is composed of 1,000 images of more than 200 subjects with their areola and nipple segmentation masks. The figure below shows an example of an image and its areola and nipple masks, which in the dataset come as a single mask with pixel value 0 for background, 1 for areola and 2 for nipple. The example is not an original image of the dataset to avoid problems with NSFW content.
Dataset will be available soon.
NTU-Nipple-v1 dataset, used in The Nipple-Areola Complex for Criminal Identification, contains 2732 images from 428 different nipple-areola complexes (NAC) but they only provide a bounding box.
The U-Net is convolutional network architecture for fast and precise segmentation of images. Up to now it has outperformed the prior best method (a sliding-window convolutional network) on the ISBI challenge for segmentation of neuronal structures in electron microscopic stacks. It is possible to use different base networks within a unet, like the different versions of ResNet.
Seg2bbox consist in converting output mask pixel values into bounding boxes. This is done by applying a contour finder to obtain x1, x2, y1 and y2 points. The figure below shows a segmentation mask with the calculated bounding box for each blob.
Download PyTorch weights for Resnet34 and place them in the directory base-model.
├── 📁 DeepNipple
│ |
│ ├── 📁 utils
│ │ ├── 📁 advanced-model
│ │ ├── 📁 base-model
│ | | ├── export.pkl
Then run the following command in the terminal:
$ python base_deepnipple.py --mode seg --img_path PATH --show True
This algorithm is public. It has been trained only on 138 images, validated on 34 images and tested on 19 images so metrics are not supported by a proper size and diversified subset.
Model | Categories | Metrics | ||
---|---|---|---|---|
Precision (%) | Recall (%) |
F1 (%) |
||
Resnet34 | Background | 99.36 ± 0.01 | 99.84 ± 0.02 | 99.59 ± 0.00 |
Areola | 68.48 ± 26.14 | 50.65 ± 31.20 | 53.67 ± 27.98 | |
Nipple | 46.38 ± 34.45 | 40.67 ± 35.00 | 38.63 ± 29.60 |
The model finds quite good the NAC but it varies a lot from image to image. It performs quite badly in images where the nipple is too far and covers only XXX a few pixels. Surprisingly, even if in those images segmentation is not that good, it finds something. As we see, standard deviation is very high, because some images get over 90% in some metrics while others get close to 0%. We find the following outputs:
- NAC is detected with success
- NAC is partially detected
- Not a single NAC pixel detected
- False positive
Detection has been reduced to the simple binary problem of finding if there is at least one nipple in the image.
Model | Category | Metrics | |
---|---|---|---|
Sensitivity (%) | Specificity (%) | ||
Resnet34 | NAC | 88.24 | 85.00 |
This algorithm is trained on 70% of the data, validated on 20% and tested on 10%. Is is still to be tested. Results will be released soon.
Model | Categories | Metrics | ||
---|---|---|---|---|
Precision (%) | Recall (%) |
F1 (%) |
||
Resnet34 | Background | - | - | - |
Areola | - | - | - | |
Nipple | - | - | - | |
Resnet101 | Background | - | - | - |
Areola | - | - | - | |
Nipple | - | - | - |
Model | Category | Metrics | |
---|---|---|---|
Sensitivity (%) | Specificity (%) | ||
Resnet34 | NAC | - | - |
Resnet101 | NAC | - | - |
DeepNippleID is a nipple identification algorithm under development. Identifiying a person has many interesting applications like finding criminals and this is typically done by face recognition. However, sexual offenders do not normally show their face in the videos. Identifying people by finding similarity in the nipples could be useful. Wojciech et al. conclude that "the experimental results indicate that the NAC can be a useful characteristic for forensic applications".
This application uses nipple detection to find nipples and censor the images by applying blur, emoji or other type of modification.
This application uses nipple detection to find nipples in videos or a large batch of images and finds NSFW content. It can be used as a filtering tool.
There is not much research on this area. I will list some of the papers I found:
- The Nipple-Areola Complex for Criminal Identification (2019)
- Nipple detection to identify negative content on digital images (2016)
- Automatic Nipple Detection based on Face Detection and Ideal Proportion Female using Random Forest (2013)
- Automatic Nipple Detection Using Cascaded AdaBoost Classifier (2012)
- Automatic Nipple Detection Using Shape and Statistical Skin Color Information (2010)
- Nipple Detection for Obscene Pictures (2005)
There is an Android App that apparently uses object detection to locate nipples.
BTC Wallet: 1DswCAGmXYQ4u2EWVJWitySM7Xo7SH4Wdf