Skip to content

Instantly share code, notes, and snippets.

@skeeet
Forked from stormraiser/danbooru_faces.md
Created February 20, 2019 11:31
Show Gist options
  • Save skeeet/7d4e3f81dccbcc0f6ea3584960888d0a to your computer and use it in GitHub Desktop.
Save skeeet/7d4e3f81dccbcc0f6ea3584960888d0a to your computer and use it in GitHub Desktop.

Revisions

  1. @stormraiser stormraiser revised this gist Dec 27, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion danbooru_faces.md
    Original file line number Diff line number Diff line change
    @@ -22,7 +22,7 @@ confidence less than 0.8. The detection results include position and size of bou
    The shape of the face box is always a square. We want the entire head while the face box only contains the visible
    part of the face. So we get our image patches as follows: We rotate the image such that the center of the eyes lie on
    the same horizontal line. After we rotate the image, we move the center of the face up by 0.35 times the edge length
    of the face box, and crop out a square with 1.5 times the edge length of the face box. These patches are only kept if
    of the face box, and crop out a square with 1.75 times the edge length of the face box. These patches are only kept if
    they are no smaller than 256x256 and are resized to 256x256.

    This dataset is intended for style classification and conditional GAN, so we classify the resulting image by artists.
  2. @stormraiser stormraiser revised this gist Dec 26, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion danbooru_faces.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Danbuuru Faces v0.1
    # Danbooru Faces v0.1

    ## Discription
    This dataset contains ~443k anime face images of size 256x256 drawn by ~7,000 artists, obtained from
  3. @stormraiser stormraiser revised this gist Dec 26, 2017. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions danbooru_faces.md
    Original file line number Diff line number Diff line change
    @@ -25,9 +25,8 @@ the same horizontal line. After we rotate the image, we move the center of the f
    of the face box, and crop out a square with 1.5 times the edge length of the face box. These patches are only kept if
    they are no smaller than 256x256 and are resized to 256x256.

    This dataset is intended for classification and conditional GAN, so we classify the resulting image by artists. To avoid
    ambiguouity, we keep a face patch only if the original post contains exactly one artist tag. Finally, artists with less
    than 20 faces patches are discarded.
    This dataset is intended for style classification and conditional GAN, so we classify the resulting image by artists.
    To avoid ambiguouity, we keep a face patch only if the original post contains exactly one artist tag. Finally, artists with less than 20 faces patches are discarded.

    ## Comments
    ### Quality of face detection
  4. @stormraiser stormraiser created this gist Dec 26, 2017.
    66 changes: 66 additions & 0 deletions danbooru_faces.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,66 @@
    # Danbuuru Faces v0.1

    ## Discription
    This dataset contains ~443k anime face images of size 256x256 drawn by ~7,000 artists, obtained from
    [Danbooru](http://danbooru.donmai.us/)

    ## Collection
    We first downloaded JSON files of all existing posts numbered from 1 to 2,800,000 using their API. We filtered the
    posts by the following criteria:

    * We focus on finished fully colored anime-style 2-d digital still images depicting human (or otherwise fully
    anthropomorphic). So posts containing any of the following tags are discarded: ```photo 3d traditional_media monochrome
    sketch lineart animated flash no_humans```

    * The score must be at least 5

    We downloaded a total of ~1.2 million images.

    ## Processing
    We detect faces with [AnimeFace 2009](https://github.com/nagadomi/animeface-2009). We discarded detected faces with
    confidence less than 0.8. The detection results include position and size of bounding boxes of eyes, mouth and the whole face.
    The shape of the face box is always a square. We want the entire head while the face box only contains the visible
    part of the face. So we get our image patches as follows: We rotate the image such that the center of the eyes lie on
    the same horizontal line. After we rotate the image, we move the center of the face up by 0.35 times the edge length
    of the face box, and crop out a square with 1.5 times the edge length of the face box. These patches are only kept if
    they are no smaller than 256x256 and are resized to 256x256.

    This dataset is intended for classification and conditional GAN, so we classify the resulting image by artists. To avoid
    ambiguouity, we keep a face patch only if the original post contains exactly one artist tag. Finally, artists with less
    than 20 faces patches are discarded.

    ## Comments
    ### Quality of face detection
    The face detector generally works well but does miss some faces and give some weird detection results sometimes. In
    particular, it often detects text or certain hand gesture or random things in a configuration similar to two eyes plus
    a mouth as a face. And it often misses faces that are not near upright.

    ### Image contents
    We did not exclude posts that dipict sex.

    ### Naming of the files
    The number before the underscore is the post id on Danbooru. Use ```danbooru.donmai.us/posts/<post_id>``` to access the page.
    The number after the underscore is the serial number of detected faces. These may not be continuous since some may have been
    disarded for various reasons.

    ### Duplications
    Many posts are similar in different ways: they may be the scan of the same digital image printed on different places;
    they may be digital images with slightly different content, where only the facial expression of a character is changed, etc.
    We may want to discard duplications of the former type but keep those of the latter type. There does not seem to be a
    straightforward solution.

    ## Future directions
    We will likely need a better face detector. Ideally it can give us the correct head pose, which would be useful way beyond
    making this dataset. Unfortunately unlike real head pose detectors where training data can be easily synthesized, for
    these non-physical images we proably need to label a lot of images manually.

    Discarded patchs that are too small can be enhanced with e.g. waifu2x and still be useful.

    Find a way to solve duplication.

    ## Just for fun
    I put 7 face patches from one of my own drawings there. They are obviously not from Danbooru and I put 0 as the post id.
    Remove ```stormraiser``` from the files if you don't want it.

    ## Download
    [Google Drive link](https://drive.google.com/file/d/1_0zo68Pv3IJ0XOuJoi4n3sI9C-7_w7A_/view?usp=sharing)