Coder Social home page Coder Social logo

sexyyolo's Introduction

Sexy Yolo


Introduction

A hierarchical detection method based on Yolov3, which can work on joint classification and detection dataset, such as COCO and NSFW. So that Yolo could detect coco categories and sexy or porn person simultaneously. (Tensorflow 1.x)


Requirements

Python version: >=Python3.6
Packages:

  • tensorflow >=1.13 (do not support Tensorflow2.0)
  • opencv-python
  • numpy
  • pyyaml

Quick Start

if model weights is ready and basic code is cloned. Please edit configs/XXX.yaml, add your local model weights path to MODEL:MODEL_WEIGHTS:, such as "path/to/yolov3".

common coco:

$ python tools/infer.py test_pic.jpg(or folder) --config-file configs/Yolov3_Coco.yaml --result-file data/demo_result

sexy and coco:

$ python tools/infer.py test_pic.jpg(or folder) --config-file configs/Yolov3_Joint_CocoAndNsfw.yaml --result-file data/demo_result

Model weights

Two model weights are provided: common COCO model and Sexy&COCO model.
Common COCO weights is converted from author of Yolov3(pjreddie.com), Sexy&COCO weights are trained on image size of 416 * 416, so mAP is less than the former but close to Yolov3 paper's 416 image size model mAP.

Name inference time(s/im) category AP@IoU=0.50:0.95 AP@IoU=0.50 AP@IoU=0.75 download
COCO 0.046 80 0.357 0.616 0.376 model
SexyCOCO 0.047 83 0.309 0.551 0.308 model

Train your own data

Sexy Yolo support train your own detection dataset and also support joint classification and detection dataset.

Train detection dataset

The detection annotation's format must be same as COCO's format. Add training dataset photo folder and annotation file to config file and run:

$ python tools/train.py --config-file configs/Yolov3_Coco.yaml

Train joint classification and detection dataset

As for classification dataset, put all the classification photos into each folder, the folder's name is catogory's name. Make your dataset folder structure as:

  • NSFW

  • -train

  • --neutral

  • --sexy

  • --porn

  • -val

  • --neutral

  • --sexy

  • --porn

Then run:

$ python tools/joint_json_creator.py path/to/NSFW

After dataset is ready, edit Yolov3_Joint_CocoAndNsfw.yaml with new dataset path. Run this start to train:

python tools/train.py --config-file configs/Yolov3_Joint_CocoAndNsfw.yaml

You can change config parameters by editing config file.


Dataset

COCO dataset: http://cocodataset.org/
NSFW dataset: https://github.com/alex000kim/nsfw_data_scraper


Evaluate model

CocoApi is needed, please install cocoapi first: https://github.com/cocodataset/cocoapi
Run this to evaluate your model:

$ python tools/eval_on_coco.py --config-file configs/Yolov3_Joint_CocoAndNsfw.yaml

More Details

sexyyolo's People

Contributors

algernonx avatar

Stargazers

zzz avatar  avatar Zhou Yuquan avatar chenxiw avatar Yingjie Ma avatar Sam Su avatar  avatar Yao SONG avatar Derek Yang avatar  avatar  avatar okba avatar lengxiao avatar Life is sweat avatar Meng Sijun avatar Andres Ramírez avatar Versie Morrison avatar canavar avatar Zyn avatar Kazunari Kato avatar Vũ Quốc Huy avatar SK avatar Alexander Kozhevin avatar  avatar  avatar  avatar  avatar  avatar  avatar eliviate avatar jiayuan avatar D0n_D0n avatar 月久矢 avatar play123 avatar Tsuan avatar  avatar  avatar  avatar Ch1y0q avatar  avatar Hang Zhou avatar  avatar Anaunsu avatar 吴元一 avatar zhongshh avatar Haifei Wang avatar WangQvQ avatar Zachary Xue avatar  avatar AdahTing avatar Nicholas Lyu avatar  avatar  avatar Kuangji7 avatar  avatar Ethan1024 avatar YOLO On Me avatar  avatar  avatar  avatar  avatar  avatar  avatar xe avatar  avatar Kedreamix avatar  avatar Well Honey avatar  avatar  avatar macrosea avatar  avatar  avatar  avatar  avatar Vito avatar Henry avatar  avatar  avatar  avatar Anser caerulescens avatar Dong ZHANG avatar 甦傑 avatar qwertyuiop avatar  avatar  avatar 十禾 avatar  avatar arvin chou avatar  avatar  avatar Changjiang Xie avatar  avatar Jianing Lu avatar Daniel Huang avatar 0.0 avatar Jack-yu1205 avatar  avatar  avatar  avatar

Watchers

 avatar ConleyKong avatar okba avatar  avatar  avatar Vũ Quốc Huy avatar  avatar  avatar

sexyyolo's Issues

CATEGORY_NUM: (80, 196)

CATEGORY_NUM: (80, 196) # coco categoty
When I give the new category number 196, the training does not work. I could not survive. Can I ask for your help?

测试实例错误

python tools/infer.py data/demo/10.jpg --config-file configs/Yolov3_Coco.yaml --result-folder data/

Use standard file APIs to check for files with this prefix.
load model weights success!
Traceback (most recent call last):
File "tools/infer.py", line 64, in
cfg['INFER']['SECOND_CATE_THRESH'])
KeyError: 'SECOND_CATE_THRESH'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.