Giter Site home page Giter Site logo

aniseg's Introduction

AniSeg

Tensorflow models for Anime character object detection.

Samples

Face detection

Face detection sample 1

Face detection sample 2

Figure segmentation

Figure detection sample 1

Figure detection sample 2

Figure detection sample 3

Usage

We provide two pretrained models: One for face detection and one for figure segmentation. Download them at Google Drive!

Here is a full example script to classify faces in the sample images:

# Assume you have saved the pretrained models under "model/" directory.

python infer_from_image.py \
--input_images=samples/inputs/*
--output_path=samples/face_detection_outputs
--inference_graph=model/face_detection/frozen_inference_graph.pb
--visualize_inference=True

In general, use the script with the following format

python infer_from_image.py \
--input_images=/PATH/TO/IMAGES/* \
--output_path=/PATH/TO/OUTPUT/FOLDER/  \
--inference_graph=/PATH/TO/frozen_inference_graph.pb  \
--visualize_inference=True

For figure segmentation model, please point --inference_graph to the segmentation model and add the additional flag

--detect_masks=True

About the models

The Face Detection is trained on the outputs of animeface-2009 detector, which is under the MIT license. The main motivation for a tensorflow version is for a much faster GPU-based detection (5-10x speedup).

The Figure Segmentation model is trained on a manually annotated dataset, which you can download here. Note some images are NSFW. We release this dataset purely for research. Please use at your own risk.

To train the model, we overlayed segmented anime figures on top of pure background images to create an artificial dataset. We found this gives a decent performance. You can find pure background images in the Danbooru 2018 dataset. Please contact us if you'd like to use our pre-generated tfrecords.

Both model is trained using the Tensorflow Object Detection repo. Our repo is a simplified fork of that.

Error cases

  • Duplicate objects

Detection error 1

  • False negatives (missing detection)

Detection error 2

  • False positives

Detection error 3

Anime related repos and datasets

Shameless self promotion of my TwinGAN model to turn people into anime characteres and cats!

Sketch coloring using PaintsTransfer and PaintsChainer.

Create anime portraits at Crypko and MakeGirlsMoe

The all-encompassing anime dataset Danbooru2017 by gwern.

My hand-curated sketch-colored image dataset.

Common questions

What's the use case?

Getting clean data is hard. The object detectors provided here can make that process easier. For example it can be used to crop faces from the Danbooru2017 dataset. Here we show some sample results of combining the two mdoels:

use case 1 use case 2 use case 3 use case 4 use case 5

Results are too noisy

There is always a tradeoff between precision and recall. Please adjust the --min_score_thresh flag accordingly.

Higher threshold means more accurate results but also more false negatives (higher chance to miss objects). Lower value gives more faces but also contains non-face objects.

Inference is too slow

Inference using CPU is slow. Please make sure you have a GPU/TPU.

Citation

If you decide to use our model and/or data, we ask you to kindly cite this repo. Have fun!

aniseg's People

Contributors

jerryli27 avatar

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.