pit-ray / Anime-Semantic-Segmentation-GAN

This repository was implemented to perform semantic segmentation for pixiv anime illust.
MIT License
53 stars 3 forks source link

error in trainning #2

Open Finger-tiao opened 3 years ago

Finger-tiao commented 3 years ago

I tried to retrain your network. The semantic image used the result of the pre-trained model you provided, but I got this error:

屏幕快照 2021-05-25 下午4 44 42

It seem like dataset's error but I have no idea. Will you provide your dataset's sample and details of your dataset? Thanks.

pit-ray commented 3 years ago

This error indicates that the dataset for training could not be loaded.

Please pull the latest master branch and try the following steps.

  1. Create the directories datasets/labels and datasets/unlabels. By the way, you can pass favorite directories with --dataset_dir and --unlabel_dataset_dir of train.py.

  2. Put the teacher data and unannotated data in them separately.
    In datasets/labels, all images are 512x256 with the original image and label data concatenated horizontally.

    In datasets/unlabels, you only put 256x256 source images.

  3. Execute next script.

    $ python train.py --dataset_dir dataset/example --unlabel_dataset_dir 
    dataset/unlabel_example

As I mentioned in my blog, when I trained it, the teacher data is 700 images, and the unlabeled dataset is 10,000 images extracted by using lbpcascade_animeface and white background against 30,000 images collected from safebooru.org.

However, according to my country's law, the copyright is with each illustrator, and it is a very gray area to publish the dataset in this repository, which is not official research or project. Therefore, I have added a blur in sample images. Sorry.

By the way, a dataset of about 100 similar images is available a GoogleDrive link in this page. If you want, I can publish a script to transform these 100 data sets to fit my model.

Thank you.

Finger-tiao commented 3 years ago

Thanks for your reply. I rearranged the dataset according to your answer. This is a data in my labels folder. The only difference is semantic image's color is set to gray. (The picture on the left is not blurred, it is just for display) 13455

The unlabel folder is same as yours, but the dataset still cannot be loaded. If possible could you publish the transform script of those 100 images?

pit-ray commented 3 years ago

dataset.py formats the images it reads and stores the cache in the dump directory. Therefore, if you have made any changes to the dataset, try deleting the dump file and then start train.py.

About your semantic images' color. My implementation recognizes classes from RGB values to convert to the one-hot vector. So cannot ignore the differences. Please rewrite float RGB value from 0.0 to 1.0 of CLASS_COLOR in functions.py.

The transform script is here.

Usage

  1. Download dataset from here.
  2. Download lbpcascade_animeface.xml from here.
  3. Do my script, but not supported a label of eye.
    $ python generate_sample_dataset.py --dir "data_01" --anime_face_cascade "lbpcascade_animeface.xml"

This script will make the mask a bit rough for noise reduction.