Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Support Delving into High-Quality Synthetic Face Occlusion Segmentation Datasets #2194

Merged
merged 17 commits into from
Nov 11, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
Next Next commit
formatting
  • Loading branch information
jinwonkim93 committed Oct 17, 2022
commit e4a9dd790a8b540635345d4ca2f3c06fcdd9d66f
19 changes: 8 additions & 11 deletions configs/_base_/datasets/occlude_face.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
split='train.txt',
pipeline=train_pipeline)


dataset_train_C = dict(
type=dataset_type,
data_root=data_root,
Expand All @@ -65,17 +64,15 @@
pipeline=train_pipeline)

dataset_valid = dict(
type=dataset_type,
data_root=data_root,
img_dir='RealOcc/image',
ann_dir='RealOcc/mask',
split='RealOcc/split/val.txt',
pipeline=test_pipeline)
type=dataset_type,
data_root=data_root,
img_dir='RealOcc/image',
ann_dir='RealOcc/mask',
split='RealOcc/split/val.txt',
pipeline=test_pipeline)

data = dict(
samples_per_gpu=2,
workers_per_gpu=2,
train=[
dataset_train_A, dataset_train_B, dataset_train_C
],
val= dataset_valid)
train=[dataset_train_A, dataset_train_B, dataset_train_C],
val=dataset_valid)
43 changes: 29 additions & 14 deletions docs/en/dataset_prepare.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!-- #region -->

## Prepare datasets

It is recommended to symlink the dataset root to `$MMSEGMENTATION/data`.
Expand Down Expand Up @@ -139,6 +140,21 @@ mmsegmentation
│ │ ├── ann_dir
│ │ │ ├── train
│ │ │ ├── val
│ ├── occlusion-aware-face-dataset
│ │ ├── train.txt
│ │ ├── NatOcc_hand_sot
│ │ │ ├── img
│ │ │ ├── mask
│ │ ├── NatOcc_object
│ │ │ ├── img
│ │ │ ├── mask
│ │ ├── RandOcc
│ │ │ ├── img
│ │ │ ├── mask
│ │ ├── RealOcc
│ │ │ ├── img
│ │ │ ├── mask
│ │ │ ├── split
```

### Cityscapes
Expand Down Expand Up @@ -378,21 +394,20 @@ python tools/convert_datasets/isaid.py /path/to/iSAID

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.


### Delving into High-Quality Synthetic Face Occlusion Segmentation Datasets

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


## Dataset Preparation

Please download the masks from this [drive](https://drive.google.com/drive/folders/15nZETWlGMdcKY6aHbchRsWkUI42KTNs5?usp=sharing) and the images from [CelebAMask-HQ](https://github.com/switchablenorms/CelebAMask-HQ), [11k Hands](https://sites.google.com/view/11khands) and [DTD](https://www.robots.ox.ac.uk/~vgg/data/dtd/).
Please download the masks from this [drive](https://drive.google.com/drive/folders/15nZETWlGMdcKY6aHbchRsWkUI42KTNs5?usp=sharing) and the images from [CelebAMask-HQ](https://github.com/switchablenorms/CelebAMask-HQ), [11k Hands](https://sites.google.com/view/11khands) and [DTD](https://www.robots.ox.ac.uk/~vgg/data/dtd/).

The extracted and upsampled COCO objects images and masks can be found in this [drive](https://drive.google.com/drive/folders/15nZETWlGMdcKY6aHbchRsWkUI42KTNs5?usp=sharing).

Please extract CelebAMask-HQ and 11k Hands images based on the splits found in [drive](https://drive.google.com/drive/folders/15nZETWlGMdcKY6aHbchRsWkUI42KTNs5?usp=sharing).
Please extract CelebAMask-HQ and 11k Hands images based on the splits found in [drive](https://drive.google.com/drive/folders/15nZETWlGMdcKY6aHbchRsWkUI42KTNs5?usp=sharing).

download file to ./data_materials

```none
CelebAMask-HQ.zip
CelebAMask-HQ-masks_corrected.7z
Expand All @@ -403,7 +418,8 @@ RealOcc-Wild.7z
coco_object.7z
dtd-r1.0.1.tar.gz
```
---

______________________________________________________________________

```bash
apt-get install p7zip-full
Expand All @@ -420,7 +436,7 @@ xargs -n 1 -i echo {}.png < train.txt > mask_train.txt
rsync -a ./CelebAMask-HQ/CelebAMask-HQ-masks_corrected/ --files-from=./mask_train.txt ./CelebAMask-HQ-WO-Train_mask
mv train.txt ../data/occlusion-aware-face-dataset
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest creating the folder occlusion-aware-face-dataset first.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay


#extact DTD
#extract DTD
tar -zxvf dtd-r1.0.1.tar.gz
mv dtd DTD

Expand All @@ -438,7 +454,6 @@ mv coco_object/* .

```


**Dataset Organization:**

```none
Expand Down Expand Up @@ -481,7 +496,7 @@ mv coco_object/* .
│ │ │ │ ├── {image}.jpg
│ │ │ ├── mask
│ │ │ │ ├── {mask}.png
│ │ ├── RandOcc
│ │ ├── RealOcc
│ │ │ ├── img
│ │ │ │ ├── {image}.jpg
│ │ │ ├── mask
Expand All @@ -496,7 +511,8 @@ mv coco_object/* .
git clone https://github.com/jinwonkim93/face-occlusion-generation.git
cd face_occlusion-generation
```
Example script to generate NatOcc hand dataset

Example script to generate NatOcc hand dataset

```bash
CUDA_VISIBLE_DEVICES=0 NUM_WORKERS=4 python main.py \
Expand All @@ -508,7 +524,8 @@ SOURCE_DATASET.MASK_DIR "path/to/mmsegmentation/data_materials/CelebAMask-HQ-WO-
OCCLUDER_DATASET.IMG_DIR "path/to/mmsegmentation/data_materials/11k-hands_img" \
OCCLUDER_DATASET.MASK_DIR "path/to/mmsegmentation/data_materials/11k-hands_masks"
```
Example script to generate NatOcc object dataset

Example script to generate NatOcc object dataset

```bash
CUDA_VISIBLE_DEVICES=0 NUM_WORKERS=4 python main.py \
Expand All @@ -519,6 +536,7 @@ SOURCE_DATASET.MASK_DIR "path/to/mmsegmentation/data_materials/CelebAMask-HQ-WO-
OCCLUDER_DATASET.IMG_DIR "path/to/mmsegmentation/data_materials/object_image_sr" \
OCCLUDER_DATASET.MASK_DIR "path/to/mmsegmentation/data_materials/object_mask_x4"
```

Example script to generate RandOcc dataset

```bash
Expand All @@ -529,8 +547,5 @@ SOURCE_DATASET.IMG_DIR "path/to/mmsegmentation/data_materials/CelebAMask-HQ-WO-T
SOURCE_DATASET.MASK_DIR "path/to/mmsegmentation/data_materials/CelebAMask-HQ-WO-Train_mask" \
OCCLUDER_DATASET.IMG_DIR "path/to/jw93/mmsegmentation/data_materials/DTD/images"
```
<!-- #endregion -->

```python

```
<!-- #endregion -->