Skip to content

Latest commit

 

History

History
 
 

dcgan_fashiongen

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

GAN(Generative Adversarial Networks) models using TorchServe

1. Create a Torch Model Archive

Execute the following command to create dcgan_fashiongen.mar :

./create_mar.sh

The create_mar.sh script does the following :

Alternatively, you can directly download the dcgan_fashiongen.mar

2. Start TorchServe and Register Model

mkdir modelstore
mv dcgan_fashiongen.mar modelstore/
torchserve --start --ncs --model-store ./modelstore --models dcgan_fashiongen.mar

3. Generate Images

Invoke the predictions API and pass following payload(JSON)

  • number_of_images : Number of images to generate
  • input_gender : OPTIONAL; If specified, needs to be one of - Men, Women
  • input_category : OPTIONAL; If specified, needs to be one of - One of - SHIRTS, SWEATERS, JEANS, PANTS, TOPS, SUITS & BLAZERS, SHORTS, JACKETS & COATS, SKIRTS, JUMPSUITS, SWIMWEAR, DRESSES
  • input_pose : OPTIONAL; If specified, needs to be one of - id_gridfs_1, id_gridfs_2, id_gridfs_3, id_gridfs_4

Example

  1. Create a single image (random gender, category, pose)

    curl -X POST -d '{"number_of_images":1}' -H "Content-Type: application/json" http://localhost:8080/predictions/dcgan_fashiongen -o img1.jpg
    

    Result image should be similar to the one below -
    Sample Image 1

  2. Create '64' images of 'Men' wearing 'Shirts' in 'id_gridfs_1' pose

    curl -X POST -d '{"number_of_images":64, "input_gender":"Men", "input_category":"SHIRTS", "input_pose":"id_gridfs_1"}' -H "Content-Type: application/json" http://localhost:8080/predictions/dcgan_fashiongen -o img2.jpg
    

    Result image should be similar to the one below -
    Sample Image 2

  3. Create '32' images of 'Women' wearing 'Dresses' in 'id_gridfs_3' pose

    curl -X POST -d '{"number_of_images":32, "input_gender":"Women", "input_category":"DRESSES", "input_pose":"id_gridfs_3"}' -H "Content-Type: application/json" http://localhost:8080/predictions/dcgan_fashiongen -o img3.jpg
    

    Result image should be similar to the one below -
    Sample Image 3