justusschock / deep_alignment_network_pytorch

PyTorch Implementation of the Deep Alignment Network
https://justusschock.github.io/deep_alignment_network_pytorch/
BSD 2-Clause "Simplified" License
38 stars 8 forks source link

Change loss and network structure #2

Closed wqz960 closed 5 years ago

wqz960 commented 5 years ago
  1. I try to run your code, but I got this:./dataset/trainset is not a valid directory and It happened in Traceback (most recent call last): File "preprocess.py", line 57, in <module> random_scale=RANDOM_SCALE File "/home/wqzhaha/anaconda3/envs/py36_torch_gpu/lib/python3.6/site-packages/shapedata/single_shape/dataset.py", line 161, in __init__ img_files = make_dataset(data_path) File "/home/wqzhaha/anaconda3/envs/py36_torch_gpu/lib/python3.6/site-packages/shapedata/utils.py", line 36, in make_dataset assert os.path.isdir(dir), '%s is not a valid directory' % dir AssertionError: ./data/dataset/trainset/ is not a valid directory
  2. if I want to do some experiment about changing the structure of network and changing the loss function, where should I modify?
justusschock commented 5 years ago

1.) I don't know your script and this isn't something I have provided, but the traceback seems to indicate that the path, which should contain your data, simply does not exist.

2.) The easiest way is to subclass the network (DeepAlignmentNetwork) and change the structure as you want to (depending on your structure, you may also have to subclass DeepAlignmentStage) and just pass other losses to the experiment (depending on your losses you maybe need to slightly adjust the closure function of your DeepAlignmentNetwork subclass)

wqz960 commented 5 years ago

@justusschock Really thank you for your kind respond and help! The script finally run! But it is my first time to use your delira. If I want to resume to train, how should I modify the train code?

justusschock commented 5 years ago

Currently, resuming is done best, if you are using the plain trainer (not the experiment as it works with a time-stamp) and pass the original savedir (including the timestep) to it. The training will then automatically be resumed