|
| 1 | +<!-- #region --> |
| 2 | + |
1 | 3 | ## Prepare datasets
|
2 | 4 |
|
3 | 5 | It is recommended to symlink the dataset root to `$MMSEGMENTATION/data`.
|
@@ -138,6 +140,21 @@ mmsegmentation
|
138 | 140 | │ │ ├── ann_dir
|
139 | 141 | │ │ │ ├── train
|
140 | 142 | │ │ │ ├── val
|
| 143 | +│ ├── occlusion-aware-face-dataset |
| 144 | +│ │ ├── train.txt |
| 145 | +│ │ ├── NatOcc_hand_sot |
| 146 | +│ │ │ ├── img |
| 147 | +│ │ │ ├── mask |
| 148 | +│ │ ├── NatOcc_object |
| 149 | +│ │ │ ├── img |
| 150 | +│ │ │ ├── mask |
| 151 | +│ │ ├── RandOcc |
| 152 | +│ │ │ ├── img |
| 153 | +│ │ │ ├── mask |
| 154 | +│ │ ├── RealOcc |
| 155 | +│ │ │ ├── img |
| 156 | +│ │ │ ├── mask |
| 157 | +│ │ │ ├── split |
141 | 158 | ```
|
142 | 159 |
|
143 | 160 | ### Cityscapes
|
@@ -376,3 +393,190 @@ python tools/convert_datasets/isaid.py /path/to/iSAID
|
376 | 393 | ```
|
377 | 394 |
|
378 | 395 | In our default setting (`patch_width`=896, `patch_height`=896, `overlap_area`=384), it will generate 33978 images for training and 11644 images for validation.
|
| 396 | + |
| 397 | +### Delving into High-Quality Synthetic Face Occlusion Segmentation Datasets |
| 398 | + |
| 399 | +The dataset is generated by two techniques, Naturalistic occlusion generation, Random occlusion generation. you must install face-occlusion-generation and dataset. see more guide in https://github.com/kennyvoo/face-occlusion-generation.git |
| 400 | + |
| 401 | +## Dataset Preparation |
| 402 | + |
| 403 | +step 1 |
| 404 | + |
| 405 | +Create a folder for data generation materials on mmsegmentation folder. |
| 406 | + |
| 407 | +```shell |
| 408 | +mkdir data_materials |
| 409 | +``` |
| 410 | + |
| 411 | +step 2 |
| 412 | + |
| 413 | +Please download the masks (11k-hands_mask.7z,CelebAMask-HQ-masks_corrected.7z) from this [drive](https://drive.google.com/drive/folders/15nZETWlGMdcKY6aHbchRsWkUI42KTNs5?usp=sharing) |
| 414 | + |
| 415 | +Please download the images from [CelebAMask-HQ](https://github.com/switchablenorms/CelebAMask-HQ), [11k Hands.zip](https://sites.google.com/view/11khands) and [dtd-r1.0.1.tar.gz](https://www.robots.ox.ac.uk/~vgg/data/dtd/). |
| 416 | + |
| 417 | +step 3 |
| 418 | + |
| 419 | +Download a upsampled COCO objects images and masks (coco_object.7z). files can be found in this [drive](https://drive.google.com/drive/folders/15nZETWlGMdcKY6aHbchRsWkUI42KTNs5?usp=sharing). |
| 420 | + |
| 421 | +Download CelebAMask-HQ and 11k Hands images split txt files. (11k_hands_sample.txt, CelebAMask-HQ-WO-train.txt) found in [drive](https://drive.google.com/drive/folders/15nZETWlGMdcKY6aHbchRsWkUI42KTNs5?usp=sharing). |
| 422 | + |
| 423 | +download file to ./data_materials |
| 424 | + |
| 425 | +```none |
| 426 | +CelebAMask-HQ.zip |
| 427 | +CelebAMask-HQ-masks_corrected.7z |
| 428 | +CelebAMask-HQ-WO-train.txt |
| 429 | +RealOcc.7z |
| 430 | +RealOcc-Wild.7z |
| 431 | +11k-hands_mask.7z |
| 432 | +11k Hands.zip |
| 433 | +11k_hands_sample.txt |
| 434 | +coco_object.7z |
| 435 | +dtd-r1.0.1.tar.gz |
| 436 | +``` |
| 437 | + |
| 438 | +______________________________________________________________________ |
| 439 | + |
| 440 | +```bash |
| 441 | +apt-get install p7zip-full |
| 442 | + |
| 443 | +cd data_materials |
| 444 | + |
| 445 | +#make occlusion-aware-face-dataset folder |
| 446 | +mkdir path-to-mmsegmentaion/data/occlusion-aware-face-dataset |
| 447 | + |
| 448 | +#extract celebAMask-HQ and split by train-set |
| 449 | +unzip CelebAMask-HQ.zip |
| 450 | +7za x CelebAMask-HQ-masks_corrected.7z -o./CelebAMask-HQ |
| 451 | +#copy training data to train-image-folder |
| 452 | +rsync -a ./CelebAMask-HQ/CelebA-HQ-img/ --files-from=./CelebAMask-HQ-WO-train.txt ./CelebAMask-HQ-WO-Train_img |
| 453 | +#create a file-name txt file for copying mask |
| 454 | +basename -s .jpg ./CelebAMask-HQ-WO-Train_img/* > train.txt |
| 455 | +#add .png to file-name txt file |
| 456 | +xargs -n 1 -i echo {}.png < train.txt > mask_train.txt |
| 457 | +#copy training data to train-mask-folder |
| 458 | +rsync -a ./CelebAMask-HQ/CelebAMask-HQ-masks_corrected/ --files-from=./mask_train.txt ./CelebAMask-HQ-WO-Train_mask |
| 459 | +mv train.txt ../data/occlusion-aware-face-dataset |
| 460 | + |
| 461 | +#extract DTD |
| 462 | +tar -zxvf dtd-r1.0.1.tar.gz |
| 463 | +mv dtd DTD |
| 464 | + |
| 465 | +#extract hands dataset and split by 200 samples |
| 466 | +7za x 11k-hands_masks.7z -o. |
| 467 | +unzip Hands.zip |
| 468 | +rsync -a ./Hands/ --files-from=./11k_hands_sample.txt ./11k-hands_img |
| 469 | + |
| 470 | +#extract upscaled coco object |
| 471 | +7za x coco_object.7z -o. |
| 472 | +mv coco_object/* . |
| 473 | + |
| 474 | +#extract validation set |
| 475 | +7za x RealOcc.7z -o../data/occlusion-aware-face-dataset |
| 476 | + |
| 477 | +``` |
| 478 | + |
| 479 | +**Dataset material Organization:** |
| 480 | + |
| 481 | +```none |
| 482 | +
|
| 483 | +├── data_materials |
| 484 | +│ ├── CelebAMask-HQ-WO-Train_img |
| 485 | +│ │ ├── {image}.jpg |
| 486 | +│ ├── CelebAMask-HQ-WO-Train_mask |
| 487 | +│ │ ├── {mask}.png |
| 488 | +│ ├── DTD |
| 489 | +│ │ ├── images |
| 490 | +│ │ │ ├── {classA} |
| 491 | +│ │ │ │ ├── {image}.jpg |
| 492 | +│ │ │ ├── {classB} |
| 493 | +│ │ │ │ ├── {image}.jpg |
| 494 | +│ ├── 11k-hands_img |
| 495 | +│ │ ├── {image}.jpg |
| 496 | +│ ├── 11k-hands_mask |
| 497 | +│ │ ├── {mask}.png |
| 498 | +│ ├── object_image_sr |
| 499 | +│ │ ├── {image}.jpg |
| 500 | +│ ├── object_mask_x4 |
| 501 | +│ │ ├── {mask}.png |
| 502 | +
|
| 503 | +``` |
| 504 | + |
| 505 | +## Data Generation |
| 506 | + |
| 507 | +```bash |
| 508 | +git clone https://github.com/kennyvoo/face-occlusion-generation.git |
| 509 | +cd face_occlusion-generation |
| 510 | +``` |
| 511 | + |
| 512 | +Example script to generate NatOcc hand dataset |
| 513 | + |
| 514 | +```bash |
| 515 | +CUDA_VISIBLE_DEVICES=0 NUM_WORKERS=4 python main.py \ |
| 516 | +--config ./configs/natocc_hand.yaml \ |
| 517 | +--opts OUTPUT_PATH "path/to/mmsegmentation/data/occlusion-aware-face-dataset/NatOcc_hand_sot"\ |
| 518 | +AUGMENTATION.SOT True \ |
| 519 | +SOURCE_DATASET.IMG_DIR "path/to/data_materials/CelebAMask-HQ-WO-Train_img" \ |
| 520 | +SOURCE_DATASET.MASK_DIR "path/to/mmsegmentation/data_materials/CelebAMask-HQ-WO-Train_mask" \ |
| 521 | +OCCLUDER_DATASET.IMG_DIR "path/to/mmsegmentation/data_materials/11k-hands_img" \ |
| 522 | +OCCLUDER_DATASET.MASK_DIR "path/to/mmsegmentation/data_materials/11k-hands_masks" |
| 523 | +``` |
| 524 | + |
| 525 | +Example script to generate NatOcc object dataset |
| 526 | + |
| 527 | +```bash |
| 528 | +CUDA_VISIBLE_DEVICES=0 NUM_WORKERS=4 python main.py \ |
| 529 | +--config ./configs/natocc_objects.yaml \ |
| 530 | +--opts OUTPUT_PATH "path/to/mmsegmentation/data/occlusion-aware-face-dataset/NatOcc_object" \ |
| 531 | +SOURCE_DATASET.IMG_DIR "path/to/mmsegmentation/data_materials/CelebAMask-HQ-WO-Train_img" \ |
| 532 | +SOURCE_DATASET.MASK_DIR "path/to/mmsegmentation/data_materials/CelebAMask-HQ-WO-Train_mask" \ |
| 533 | +OCCLUDER_DATASET.IMG_DIR "path/to/mmsegmentation/data_materials/object_image_sr" \ |
| 534 | +OCCLUDER_DATASET.MASK_DIR "path/to/mmsegmentation/data_materials/object_mask_x4" |
| 535 | +``` |
| 536 | + |
| 537 | +Example script to generate RandOcc dataset |
| 538 | + |
| 539 | +```bash |
| 540 | +CUDA_VISIBLE_DEVICES=0 NUM_WORKERS=4 python main.py \ |
| 541 | +--config ./configs/randocc.yaml \ |
| 542 | +--opts OUTPUT_PATH "path/to/mmsegmentation/data/occlusion-aware-face-dataset/RandOcc" \ |
| 543 | +SOURCE_DATASET.IMG_DIR "path/to/mmsegmentation/data_materials/CelebAMask-HQ-WO-Train_img/" \ |
| 544 | +SOURCE_DATASET.MASK_DIR "path/to/mmsegmentation/data_materials/CelebAMask-HQ-WO-Train_mask" \ |
| 545 | +OCCLUDER_DATASET.IMG_DIR "path/to/jw93/mmsegmentation/data_materials/DTD/images" |
| 546 | +``` |
| 547 | + |
| 548 | +**Dataset Organization:** |
| 549 | + |
| 550 | +```none |
| 551 | +├── data |
| 552 | +│ ├── occlusion-aware-face-dataset |
| 553 | +│ │ ├── train.txt |
| 554 | +│ │ ├── NatOcc_hand_sot |
| 555 | +│ │ │ ├── img |
| 556 | +│ │ │ │ ├── {image}.jpg |
| 557 | +│ │ │ ├── mask |
| 558 | +│ │ │ │ ├── {mask}.png |
| 559 | +│ │ ├── NatOcc_object |
| 560 | +│ │ │ ├── img |
| 561 | +│ │ │ │ ├── {image}.jpg |
| 562 | +│ │ │ ├── mask |
| 563 | +│ │ │ │ ├── {mask}.png |
| 564 | +│ │ ├── RandOcc |
| 565 | +│ │ │ ├── img |
| 566 | +│ │ │ │ ├── {image}.jpg |
| 567 | +│ │ │ ├── mask |
| 568 | +│ │ │ │ ├── {mask}.png |
| 569 | +│ │ ├── RealOcc |
| 570 | +│ │ │ ├── img |
| 571 | +│ │ │ │ ├── {image}.jpg |
| 572 | +│ │ │ ├── mask |
| 573 | +│ │ │ │ ├── {mask}.png |
| 574 | +│ │ │ ├── split |
| 575 | +│ │ │ │ ├── val.txt |
| 576 | +``` |
| 577 | + |
| 578 | +<!-- #endregion --> |
| 579 | + |
| 580 | +```python |
| 581 | + |
| 582 | +``` |
0 commit comments