Skip to content

온라인 강의를 수강하고 토이 프로젝트를 진행 합니다.

Notifications You must be signed in to change notification settings

overfitting-ai-community/basic-course

Repository files navigation

basic-course

Webtoon Image Segmentation

Here is information about webtoon literary property of naver webtoon.
please just use the code for research purposes, never distribute the toon data.

And then, We can provide the step 'Get Webtoon Image -> Webtoon-Segmentation -> Create Segmentation Datasets'

First, we created webcrawling and cut detector only use computer vision(no deep learning)
see more information, go to title 'Get Webtoon Image'

Second, we learned segmentation model.
see more information, go to title 'Webtoon-Segmentation'

Third, we created segmentation results. it can be used at colorization datasets, etc...
see more information, go to title 'Create Segmentation Results'

Last, we shared our insights from proceeding this toy project.
see more information, go to title 'Conclusion(Our insights)'

Get Webtoon Image

If you want to use the webtoon data, run 'get_toon_data.py'

Prerequisites

It needs to download driver.exe.
If you use the chrome, you might use chromedriver.exe.
In this here, you can download chromedriver with your same chrome version.

pip install selenium
pip install opencv-python
python get_toon_data.py

Functions:

  • webcrawling: webcrawling function
  • linkimg: link the all webcrawling image at same episode
  • cutdetector_rough: cutdect rougly. get speech bubble, big cut dected image
  • cutdetector: final output cutdector

Examples of output images:

webcrawling linkimg (short example) cutdetector_rough cutdetector
0 image 1041 1041
- - 1440 -
- - 1768 -

output directories:

	get_toon_data.py
	chromedriver.exe
        ├── webcrawlingimg
            └── Episode100
                └── 0.jpg(webcrawling image)
                └── 1.jpg(webcrawling image)
                └── '...'.jpg(webcrawling image)
            └── Episode101
            └── ...
        └── cuts
            └── Episode100
                └── outputs(final cutdetector)
                    └── 592.jpg(final cutdetector)
                    └── '...'.jpg(final cutdetector)
                └── 592.jpg(rough cutdetector)
                └── '...'.jpg(rough cutdetector)
            └── Episode101
            └── ...

Webtoon-Segmentation

Class

0 : hair
1 : dress-shirt
2 : T-shirt
3 : pants
4 : skirt
5 : outer
6 : tie
7 : vest

Results

Trained dataset

  • Note: Free draw 프리드로우 (random part(0.9 percent of entire images) of episode 1,2,3,4,5,102,201)
  • Note: Love revolution 연애혁명 (random part(0.9 percent of entire images) of episode 2,3,4,5,6,7,8)

Test dataset

  • Note: Free draw 프리드로우 (another random part(0.1 percent of entire images) of episode 1,2,3,4,5,102,201)
  • Note: Love revolution 연애혁명 (another random part(0.1 percent of entire images) of episode 2,3,4,5,6,7,8)
  • Free draw + Love revolution
  • Only Free draw
  • Love revolution

Iterations

  • train(Free draw + Love revolution): 20000
  • pretrain: 20000
  • transfer learning: 10000~

experiment 1) Trained(Free draw + Love Revolution) -> Test(Free draw + Love Revolution)

  • Evaluation results for bbox:

bbox1
bbox2
bbox3

  • Evaluation results for Segm:

segm1
segm2
segm3

experiment 2) Trained(Free draw + Love Revolution) -> Test(Free draw)

  • Evaluation results for bbox:

bbox1
bbox2
bbox3

  • Evaluation results for Segm:

segm1
segm2
segm3

experiment 3) Trained(Free draw + Love Revolution) -> Test(Love Revolution)

  • Evaluation results for bbox:

bbox1
bbox2
bbox3

  • Evaluation results for Segm:

segm1
segm2
segm3

experiment 4) Trained(Only Free draw) -> Test(Only Free draw)

  • Evaluation results for bbox:

bbox1
bbox2
bbox3

  • Evaluation results for Segm:

segm1
segm2
segm3

experiment 5) Pretrained(Free draw) + Transfer learning(Love Revolution) -> Test(Love Revolution)

  • Evaluation results for bbox:

bbox1
bbox2
bbox3

  • Evaluation results for Segm:

segm1
segm2
segm3

experiment 6) Trained(Only Love Revolution) -> Test(Only Love Revolution)

  • Evaluation results for bbox:

bbox1
bbox2
bbox3

  • Evaluation results for Segm:

segm1
segm2
segm3

experiment 7) Pretrained(Love Revolution) + Transfer learning(Free draw) -> Test(Free draw)

  • Evaluation results for bbox:

bbox1
bbox2
bbox3

  • Evaluation results for Segm:

segm1
segm2
segm3

Examples of output images (experiment 1):

  • Results of Experiment 1(Trained(Free draw + Love Revolution) -> Test(Free draw + Love Revolution))
  • Free draw (test set of episode (1,2,3,4,5,102,201))
model prediction original
11661 11661
12197 12197
14289 14289
15991 15991
16205 16205
17759 17759
21912 21912
22515 22515
22861 22861
23968 23968
24213 24213
25413 25413
27575 27575
30278 30278
34111 34111
35419 35419
36317 36317
37949 37949
48075 48075
48683 48683
53380 53380
  • Love revolution(test set of episode (2,3,4,5,6,7,8) + episode(10))
model prediction original
1288 1288
8181 8181
12241 12241
12602 12602
13143 13143
16515 16515
30354 30354
34234 34234
10_19732 10_19732
10_20862 10_20862
10_27480 10_27480
10_42826 10_42826

Download Pre-trained models

Download pre-trained model from Google Drive

Run

Create Segmentation Results

Examples of output images:

refer to the last cell of detectron2 colab guide.

Free draw (only hair) Love revolution (only shirts) No trained webtoon (etc)
19028 10435 12296 tie
63842 12280 5233 shirt
50152 20404 86848 hair
24992 38444 7649 pants
28738 33124 18688 outer

Conclusion(Our insights)

  • 실험 결과
    • 연애혁명, 프리드로우 각 데이터셋만 학습한 (2)의 경우와 두 데이터셋을 함께 학습한 (3)의 경우보다, 서로의 데이터셋으로 pre-train 후 transfer learning 했는 (1)의 결과가 더욱 좋았다.
      • case 연애혁명:
        • (1) pretrained(프리드로우) + transfer learning(연애혁명) -> test(연애혁명)의 AP 55.283
        • (2) train(연애혁명) -> test(연애혁명)의 AP 48.234
        • (3) train(연애혁명 + 프리드로우) -> test(연애혁명)의 AP 52.604
      • case 프리드로우:
        • (1) pretrained(연애혁명) + transfer learning(프리드로우) -> test(프리드로우)의 AP 46.994
        • (2) train(프리드로우) -> test(프리드로우)의 AP 43.321
        • (3) train(연애혁명 + 프리드로우) -> test(프리드로우)의 AP 30.942
    • pretrained 후 transfer learning을 연애혁명 + 프리드로우의 경우는 실험하지 않았다.
    • 최종 학습된 결과가 최선의 iterations 인지는 확인해보지 않았다.
  • 웹툰에서 등장인물에 대한 신체 특징(헤어), 의상을 자동채색하기 위해서, 웹툰 등장인물에 대한 Segmentation을 진행하였다.
  • 자동채색을 위해 데이터셋을 Segmentation 하는 것까지 진행하였고, 그 결과가 'Create Segmentation Results' 부분이다.
  • 우리의 목표는 한 컷의 이미지를 전부 자동채색하는 것이 아닌 특정 부분, 부분을 자동채색하는 것이다. 따라서 모델의 학습을 위해 특정 클래스로 세분화했다.
  • 웹툰은 무한히 상상할 수 있는 세계로, 뿔, 날개, 꼬리 등과 같이 인물이 가질 수 있는 다양한 특징들이 무수히 많다. 이것을 모두 클래스화 하기에는 무리가 있다.
  • 따라서 웹툰 이미지의 인물의 특징 중에서도 '헤어'와 '교복'으로 그 범위를 한정하여 데이터를 수집, 클래스화 하였다.
  • Detectron2의 Weight를 가져온 이후에, 모델이 해당 데이터셋에 대하여 오버피팅이 되도록 의도하였다.
  • 그 이유는 자동채색하기 위한 하나의 웹툰에 대해서 해당 웹툰의 특징을 더 잘 살려서 Segmentation 하기 위함이다.
  • 모든 웹툰에 대하여 Robust하게 Segmentation을 진행할 수도 있지만, 다양한 장르의 현존하는 모든 웹툰에 대하여 Robust하게 Segmentation을 할 수는 없다고 판단하였다.
  • 또한 각각의 웹툰은 그 웹툰만의 고유한 특징(그림체, 장르 등)이 있다. 그 웹툰만의 고유한 특징을 잘 살리는 것(하나의 웹툰에 오버피팅)이 중요하다고 판단하였다.
  • 수집한 웹툰의 데이터셋은 하나의 웹툰에서도 회차가 진행될 수록 작가의 그림체가 바뀌는 것을 고려하였다.

Team players

nh9k, haechunchung, minqukanq

Additional Information

All images used in dataset are copyrighted in Naver Webtoon.
If there is a related problem, We will correct or delete the repository immediately.
Also, We would like to inform you that our team members are not related to Naver Webtoon.

Citing Detectron2

We use detectron2 in our research

@misc{wu2019detectron2,
  author =       {Yuxin Wu and Alexander Kirillov and Francisco Massa and
                  Wan-Yen Lo and Ross Girshick},
  title =        {Detectron2},
  howpublished = {\url{https://github.com/facebookresearch/detectron2}},
  year =         {2019}
}

Citing Mask R-CNN

Reference (repo)

akTwelve / cocosynth
We use Mask R-CNN in our research

@misc{matterport_maskrcnn_2017,
  title={Mask R-CNN for object detection and instance segmentation on Keras and TensorFlow},
  author={Waleed Abdulla},
  year={2017},
  publisher={Github},
  journal={GitHub repository},
  howpublished={\url{https://github.com/matterport/Mask_RCNN}},
}

About

온라인 강의를 수강하고 토이 프로젝트를 진행 합니다.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published