Module Name | stgan_celeba |
---|---|
Category | image generation |
Network | STGAN |
Dataset | Celeba |
Fine-tuning supported or not | No |
Module Size | 287MB |
Latest update date | 2021-02-26 |
Data indicators | - |
-
- STGAN takes the original attribute and the target attribute as input, and proposes STUs (Selective transfer units) to select and modify features of the encoder. 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".
-
-
paddlepaddle >= 1.5.2
-
paddlehub >= 1.0.0 | How to install PaddleHub
-
-
-
$ hub install stgan_celeba==1.0.0
- In case of any problems during installation, please refer to:Windows_Quickstart | Linux_Quickstart | Mac_Quickstart
-
-
-
$ hub run stgan_celeba --image "/PATH/TO/IMAGE" --info "original_attributes" --style "target_attribute"
-
Parameters
-
image: Image path
-
info: Attributes of original image, must fill in gender( "Male" or "Female").The options are "Bald", "Bangs", "Black_Hair", "Blond_Hair", "Brown_Hair", "Bushy_Eyebrows", "Eyeglasses", "Mouth_Slightly_Open", "Mustache", "No_Beard", "Pale_Skin", "Aged". For example, the input picture is a girl with black hair, then fill in as "Female,Black_Hair".
-
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
-
-
-
import paddlehub as hub stgan = hub.Module(name="stgan_celeba") test_img_path = ["/PATH/TO/IMAGE"] org_info = ["Female,Black_Hair"] trans_attr = ["Bangs"] # set input dict input_dict = {"image": test_img_path, "style": trans_attr, "info": org_info} # execute predict and print the result results = stgan.generate(data=input_dict) print(results)
-
-
-
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.
- info (list[str]): Represents the face attributes of the original image. Different attributes are separated by commas.
- data(list[dict]): Each element in the list is dict and each field is:
-
Return
- res (list[str]): Save path of the result.
-
-
-
1.0.0
First release