andrewjong / SwapNet

Virtual Clothing Try-on with Deep Learning. PyTorch reproduction of SwapNet by Raj et al. 2018. Now with Docker support!
377 stars 117 forks source link

Add args.json to provided checkpoints download #21

Closed Devetec closed 4 years ago

Devetec commented 4 years ago

When I try to inference using the given command, I get this error:

model None
dataset None
=====OPTIONS======
config_file : None
comments : 
verbose : False
display_winsize : 256
checkpoints_dir : ./checkpoints
load_epoch : latest
dataset : None
dataset_mode : image
cloth_representation : labels
body_representation : rgb
cloth_channels : 19
body_channels : 12
texture_channels : 3
pad : False
load_size : 128
crop_size : 128
crop_bounds : None
max_dataset_size : 50
batch_size : 8
shuffle_data : True
num_workers : 4
gpu_id : 0
no_confirm : False
interval : 1
warp_checkpoint : None
texture_checkpoint : None
checkpoint : checkpoints/deep_fashion
body_dir : None
cloth_dir : None
texture_dir : None
results_dir : results
skip_intermediates : False
dataroot : data/deep_fashion
model : None
name : 
is_train : False
==================
The experiment directory 'results' already exists.
 Here are its contents:
     ['warp', 'args.json']

 Existing data will be overwritten!
 Are you sure you want to continue? (y/N): y

Set warp_checkpoint to checkpoints/deep_fashion/warp/latest_net_generator.pth
Set texture_checkpoint to checkpoints/deep_fashion/texture/latest_net_generator.pth
Running warp inference...
Rebuilding warp from checkpoints/deep_fashion/warp/latest_net_generator.pth
Not overriding: {'shuffle_data', 'dataroot', 'checkpoint'}
Traceback (most recent call last):
  File "inference.py", line 217, in <module>
    _run_warp()
  File "inference.py", line 137, in _run_warp
    opt.warp_checkpoint, cloth_dir=opt.cloth_dir, body_dir=opt.body_dir
  File "inference.py", line 72, in _rebuild_from_checkpoint
    model = create_model(loaded_opt)
  File "/content/SwapNet/models/__init__.py", line 41, in create_model
    model = find_model_using_name(opt.model)
  File "/content/SwapNet/models/__init__.py", line 11, in find_model_using_name
    model_filename = "models." + model_name + "_model"
TypeError: must be str, not NoneType

with this command:

!python inference.py --checkpoint checkpoints/deep_fashion \
  --dataroot data/deep_fashion \
  --shuffle_data True

Might be related to #17, as your bugfix seems to have worked, but now I have another problem.

andrewjong commented 4 years ago

Can you post the contents of checkpoints/deep_fashion/warp/args.json? Is there a model in there?

Devetec commented 4 years ago

The checkpoint did not come with one, so I tried to make one.

Why didn't it come with one?

andrewjong commented 4 years ago

@KingOfCoders The checkpoint should be created throughout training, and args.json should be stored immediately after running train.py. Did that not happen when you tried it?

Devetec commented 4 years ago

I tried to use the pretrained models...

andrewjong commented 4 years ago

Oops, that's an excellent point. Thank you for bringing that to my attention, I will upload the associated args.json with the checkpoints.

andrewjong commented 4 years ago

In the meantime, try these

warp/args.json

{
    "config_file": null,
    "name": "deep_fashion/warp",
    "comments": "",
    "verbose": false,
    "display_winsize": 256,
    "checkpoints_dir": "./checkpoints",
    "load_epoch": "latest",
    "dataroot": "data/deep_fashion",
    "dataset": "warp",
    "dataset_mode": "image",
    "cloth_representation": "labels",
    "body_representation": "rgb",
    "cloth_channels": 19,
    "body_channels": 12,
    "texture_channels": 3,
    "pad": false,
    "load_size": 128,
    "crop_size": 128,
    "crop_bounds": null,
    "max_dataset_size": Infinity,
    "batch_size": 8,
    "shuffle_data": true,
    "num_workers": 4,
    "gpu_id": 0,
    "no_confirm": true,
    "model": "warp",
    "continue_train": false,
    "display_freq": 400,
    "display_ncols": 4,
    "display_id": 1,
    "display_server": "http://localhost",
    "display_env": "main",
    "display_port": 8097,
    "update_html_freq": 1000,
    "print_freq": 100,
    "no_html": false,
    "n_epochs": 20,
    "start_epoch": 0,
    "sample_freq": null,
    "checkpoint_freq": 2,
    "latest_checkpoint_freq": 5120,
    "save_by_iter": false,
    "weight_decay": 0,
    "init_type": "kaiming",
    "init_gain": 0.02,
    "warp_mode": "gan",
    "lambda_ce": 100,
    "gan_mode": "vanilla",
    "lambda_gan": 1.0,
    "lambda_gp": 10,
    "discriminator": "basic",
    "n_layers_D": 3,
    "norm": "instance",
    "optimizer_G": "AdamW",
    "lr": 0.0001,
    "beta1": 0.5,
    "optimizer_D": "AdamW",
    "d_lr": 0.0004,
    "d_weight_decay": 0,
    "gan_label_mode": "smooth",
    "input_transforms": [
        "hflip",
        "vflip",
        "affine",
        "perspective"
    ],
    "per_channel_transform": true,
    "b1": 0.9,
    "b2": 0.999,
    "is_train": true
}

texture/args.json

{
    "config_file": null,
    "name": "deep_fashion/texture",
    "comments": "",
    "verbose": false,
    "display_winsize": 256,
    "checkpoints_dir": "./checkpoints",
    "load_epoch": "latest",
    "dataroot": "data/deep_fashion",
    "dataset": "texture",
    "dataset_mode": "image",
    "cloth_representation": "labels",
    "body_representation": "rgb",
    "cloth_channels": 19,
    "body_channels": 12,
    "texture_channels": 3,
    "netG": "swapnet",
    "pad": false,
    "load_size": 128,
    "crop_size": 128,
    "crop_bounds": null,
    "max_dataset_size": Infinity,
    "batch_size": 8,
    "shuffle_data": true,
    "num_workers": 4,
    "gpu_id": 0,
    "no_confirm": true,
    "model": "texture",
    "continue_train": false,
    "display_freq": 400,
    "display_ncols": 5,
    "display_id": 1,
    "display_server": "http://localhost",
    "display_env": "main",
    "display_port": 8097,
    "update_html_freq": 1000,
    "print_freq": 100,
    "no_html": false,
    "n_epochs": 20,
    "start_epoch": 0,
    "sample_freq": null,
    "checkpoint_freq": 2,
    "latest_checkpoint_freq": 5120,
    "save_by_iter": false,
    "weight_decay": 0,
    "init_type": "kaiming",
    "init_gain": 0.02,
    "gan_mode": "vanilla",
    "lambda_gan": 1.0,
    "lambda_gp": 10,
    "discriminator": "basic",
    "n_layers_D": 3,
    "norm": "instance",
    "optimizer_G": "AdamW",
    "lr": 0.0001,
    "beta1": 0.5,
    "optimizer_D": "AdamW",
    "d_lr": 0.0004,
    "d_weight_decay": 0,
    "gan_label_mode": "smooth",
    "lambda_l1": 10,
    "lambda_feat": 0,
    "input_transforms": [
        "hflip",
        "vflip"
    ],
    "b1": 0.9,
    "b2": 0.999,
    "is_train": true
}
0xymoro commented 4 years ago

Hi Andrew, please add the args.json to the pretrained models download, I also ran into this a bit ago and saw it here just now. Thanks!

Ah you might have already added it - I realized my download from an older version of the readme.

andrewjong commented 4 years ago

Done. This is now in the download. Thanks everyone.