mtli / PhotoSketch

Code for Photo-Sketching: Inferring Contour Drawings from Images :dog:
http://www.cs.cmu.edu/~mengtial/proj/sketch/
Other
464 stars 84 forks source link

SUGGESTION #13

Closed GitHubEmploy closed 9 months ago

GitHubEmploy commented 3 years ago

Hey man, I built u a ipynb file for collab. u can run it in like 3 seconds now for free.

Heres the colab: https://colab.research.google.com/drive/1Jd_bwcu96KNk8ev0E3gCpL2ryte15U7B?usp=sharing

GitHubEmploy commented 3 years ago

Sorry, I forgot to give u permissions, heres the updated link: https://colab.research.google.com/drive/1Jd_bwcu96KNk8ev0E3gCpL2ryte15U7B?usp=sharing

mtli commented 3 years ago

Hi, thanks for the suggestion! I am surprised that my old codebase works with the latest PyTorch

tom99763 commented 2 years ago

-------------- End ---------------- CustomDatasetDataLoader dataset [TestDirDataset] was created pix2pix initialization method [normal] Traceback (most recent call last): File "test_pretrained.py", line 29, in <module> main() File "test_pretrained.py", line 18, in main model = create_model(opt) File "/content/PhotoSketch/models/models.py", line 10, in create_model model.initialize(opt) File "/content/PhotoSketch/models/pix2pix_model.py", line 32, in initialize self.load_network(self.netG, 'G', opt.which_epoch) File "/content/PhotoSketch/models/base_model.py", line 54, in load_network network.load_state_dict(torch.load(save_path)) File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 581, in load with _open_file_like(f, 'rb') as opened_file: File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 230, in _open_file_like return _open_file(name_or_buffer, mode) File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 211, in __init__ super(_open_file, self).__init__(open(name, mode)) FileNotFoundError: [Errno 2] No such file or directory: '/Exp/PhotoSketch/Checkpoints/pretrained/latest_net_G.pth'

@GitHubEmploy bro how to solve this ?

FredWe commented 9 months ago

-------------- End ---------------- CustomDatasetDataLoader dataset [TestDirDataset] was created pix2pix initialization method [normal] Traceback (most recent call last): File "test_pretrained.py", line 29, in <module> main() File "test_pretrained.py", line 18, in main model = create_model(opt) File "/content/PhotoSketch/models/models.py", line 10, in create_model model.initialize(opt) File "/content/PhotoSketch/models/pix2pix_model.py", line 32, in initialize self.load_network(self.netG, 'G', opt.which_epoch) File "/content/PhotoSketch/models/base_model.py", line 54, in load_network network.load_state_dict(torch.load(save_path)) File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 581, in load with _open_file_like(f, 'rb') as opened_file: File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 230, in _open_file_like return _open_file(name_or_buffer, mode) File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 211, in __init__ super(_open_file, self).__init__(open(name, mode)) FileNotFoundError: [Errno 2] No such file or directory: '/Exp/PhotoSketch/Checkpoints/pretrained/latest_net_G.pth'

@GitHubEmploy bro how to solve this ?

add a last cell:

dataDir='/content'
!cd PhotoSketch/ && python test_pretrained.py \
    --name pretrained \
    --dataset_mode test_dir \
    --dataroot examples/ \
    --results_dir {dataDir}/PhotoSketch/Results/ \
    --checkpoints_dir {dataDir}/PhotoSketch/ \
    --model pix2pix \
    --which_direction AtoB \
    --norm batch \
    --input_nc 3 \
    --output_nc 1 \
    --which_model_netG resnet_9blocks \
    --no_dropout
FredWe commented 9 months ago

-------------- End ---------------- CustomDatasetDataLoader dataset [TestDirDataset] was created pix2pix initialization method [normal] Traceback (most recent call last): File "test_pretrained.py", line 29, in <module> main() File "test_pretrained.py", line 18, in main model = create_model(opt) File "/content/PhotoSketch/models/models.py", line 10, in create_model model.initialize(opt) File "/content/PhotoSketch/models/pix2pix_model.py", line 32, in initialize self.load_network(self.netG, 'G', opt.which_epoch) File "/content/PhotoSketch/models/base_model.py", line 54, in load_network network.load_state_dict(torch.load(save_path)) File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 581, in load with _open_file_like(f, 'rb') as opened_file: File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 230, in _open_file_like return _open_file(name_or_buffer, mode) File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 211, in __init__ super(_open_file, self).__init__(open(name, mode)) FileNotFoundError: [Errno 2] No such file or directory: '/Exp/PhotoSketch/Checkpoints/pretrained/latest_net_G.pth'

@GitHubEmploy bro how to solve this ?

or use my little fork: https://colab.research.google.com/drive/15f54uVWt-92jzGc9z44qOX_PRtJCv2tB?usp=sharing

mtli commented 9 months ago

Hi you were trying to use the pretrained model, please download it first on the project readme page.