|
- # Copyright 2022 Huawei Technologies Co., Ltd
- #
- # Licensed under the Apache License, Version 2.0 (the "License");
- # you may not use this file except in compliance with the License.
- # You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software
- # distributed under the License is distributed on an "AS IS" BASIS,
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- # See the License for the specific language governing permissions and
- # limitations under the License.
- # ============================================================================
- """ preprocess CelebA img_align_celeba data to mindrecord dataset for stargan """
- from __future__ import absolute_import
- from __future__ import division
- from __future__ import print_function
-
- import argparse
-
- from src.stargan.dataset import generate_dataset
-
-
- def main():
- parser = argparse.ArgumentParser(description="")
- parser.add_argument("--mindrecord_dir", type=str, required=True, help="dir to save mindrecord dataset.")
- parser.add_argument("--image_dir", type=str, required=True, help="dir saved CelebA img_align_celeba data.")
- parser.add_argument("--attr_path", type=str, required=True, help="file saved the CelebA dataset attributes.")
- parser.add_argument("--selected_attrs", '--list', nargs='+', help="selected attributes for the CelebA dataset.",
- default=['Black_Hair', 'Blond_Hair', 'Brown_Hair', 'Male', 'Young'])
-
- args = parser.parse_args()
-
- generate_dataset(
- mindrecord_dir=args.mindrecord_dir,
- image_dir=args.image_dir,
- attr_path=args.attr_path,
- selected_attrs=args.selected_attrs)
-
-
- if __name__ == "__main__":
- main()
|