Skip to content

Latest commit

 

History

History
110 lines (64 loc) · 3.18 KB

File metadata and controls

110 lines (64 loc) · 3.18 KB

attgan_celeba

Module Name attgan_celeba
Category image generation
Network AttGAN
Dataset Celeba
Fine-tuning supported or not No
Module Size 167MB
Latest update date 2021-02-26
Data indicators -

I. Basic Information

  • Application Effect Display

    • Sample results:


      The image attributes are: original image, Bald, Bangs, Black_Hair, Blond_Hair, Brown_Hair, Bushy_Eyebrows, Eyeglasses, Gender, Mouth_Slightly_Open, Mustache, No_Beard, Pale_Skin, Aged

  • Module Introduction

    • AttGAN is a Generative Adversarial Network, which uses classification loss and reconstruction loss to train the network. The PaddleHub Module is trained one Celeba dataset and currently supports attributes of "Bald", "Bangs", "Black_Hair", "Blond_Hair", "Brown_Hair", "Bushy_Eyebrows", "Eyeglasses", "Gender", "Mouth_Slightly_Open", "Mustache", "No_Beard", "Pale_Skin", "Aged".

II. Installation

III. Module API Prediction

  • 1、Command line Prediction

    • $ hub run attgan_celeba --image "/PATH/TO/IMAGE" --style "target_attribute" 
    • Parameters

      • image: Input image path.

      • style: Specify the attributes to be converted. The options are "Bald", "Bangs", "Black_Hair", "Blond_Hair", "Brown_Hair", "Bushy_Eyebrows", "Eyeglasses", "Gender", "Mouth_Slightly_Open", "Mustache", "No_Beard", "Pale_Skin", "Aged". You can choose one of the options.

    • If you want to call the Hub module through the command line, please refer to: PaddleHub Command Line Instruction

  • 2、Prediction Code Example

    • import paddlehub as hub
      
      attgan = hub.Module(name="attgan_celeba")
      
      test_img_path = ["/PATH/TO/IMAGE"]
      trans_attr = ["Bangs"]
      
      # set input dict
      input_dict = {"image": test_img_path, "style": trans_attr}
      
      # execute predict and print the result
      results = attgan.generate(data=input_dict)
      print(results)
  • 3、API

    • def generate(data)
      • Style transfer API.

      • Parameter

        • data(list[dict]): Each element in the list is dict and each field is:
          • image (list[str]): Each element in the list is the path of the image to be converted.
          • style (list[str]): Each element in the list is a string, fill in the face attributes to be converted.
      • Return

        • res (list[str]): Save path of the result.

IV. Release Note

  • 1.0.0

    First release