STANet icon indicating copy to clipboard operation
STANet copied to clipboard

error running demo

Open gregjim opened this issue 4 years ago • 5 comments

I get the following output and error running the demo: FileNotFoundError: [Errno 2] No such file or directory: './checkpoints\pam\pam_net_F.pth'

Any help would be greatly appreciated thank you.

Here is the full output from the demo:

----------------- Options --------------- SA_mode: BAM
angle: 0
arch: mynet3
aspect_ratio: 1.0
batch_size: 1
checkpoints_dir: ./checkpoints
crop_size: 256
dataroot: ./LEVIR-CD
dataset_mode: changedetection
dataset_type: CD_LEVIR
display_winsize: 256
ds: 1 [default: 1] epoch: latest
eval: False
f_c: 64
gpu_ids: -1 [default: 0] init_gain: 0.02
init_type: normal
input_nc: 3
isTrain: False [default: None] istest: False
json_name: train_val_test
load_iter: 0 [default: 0] load_size: 256
max_dataset_size: inf
model: CDF0
n_class: 2
name: experiment_name
no_flip: True
ntest: inf
num_test: 50
num_threads: 4
output_nc: 3
phase: test
preprocess: resize_and_crop
results_dir: ./results/
serial_batches: False
split: train
suffix:
val_dataroot: ./LEVIR-CD
val_dataset_mode: changedetection
val_dataset_type: CD_LEVIR
val_json_name: train_val_test
val_split: val
verbose: False
----------------- End ------------------- changedetection ['./samples\A\test_102_0512_0000.png', './samples\A\test_121_0768_0256.png', './samples\A\test_2_0000_0000.png', './samples\A\test_2_0000_0512.png', './samples\A\test_55_0256_0000.png', './samples\A\test_77_0512_0256.png'] dataset [ChangeDetectionDataset] was created using mynet3 backbone arch: mynet3 in_c: 3 ds: 1 model [CDFAModel] was created loading the model from ./checkpoints\pam\pam_net_F.pth

FileNotFoundError Traceback (most recent call last) ~\Documents\STANet-master\demo.py in 80 data_root = './samples' 81 results_dir = './samples/output/' ---> 82 pred_image(data_root, results_dir)

~\Documents\STANet-master\demo.py in pred_image(data_root, results_dir) 67 opt.results_dir = results_dir 68 ---> 69 val(opt) 70 71

~\Documents\STANet-master\demo.py in val(opt) 34 dataset = create_dataset(opt) # create a dataset given opt.dataset_mode and other options 35 model = create_model(opt) # create a model given opt.model and other options ---> 36 model.setup(opt) # regular setup: load and print networks; create schedulers 37 save_path = opt.results_dir 38 mkdir(save_path)

~\Documents\STANet-master\models\base_model.py in setup(self, opt) 117 if not self.isTrain or opt.continue_train: 118 load_suffix = 'iter_%d' % opt.load_iter if opt.load_iter > 0 else opt.epoch --> 119 self.load_networks(load_suffix) 120 self.print_networks(opt.verbose) 121

~\Documents\STANet-master\models\base_model.py in load_networks(self, epoch) 285 # GitHub source), you can remove str() on self.device 286 state_dict = torch.load(load_path, map_location=str(self.device)) --> 287 if hasattr(state_dict, '_metadata'): 288 del state_dict._metadata 289 # patch InstanceNorm checkpoints prior to 0.4

~\anaconda3\envs\dswh_env\lib\site-packages\torch\serialization.py in load(f, map_location, pickle_module, **pickle_load_args) 577 pickle_load_args['encoding'] = 'utf-8' 578 --> 579 with _open_file_like(f, 'rb') as opened_file: 580 if _is_zipfile(opened_file): 581 # The zipfile reader is going to advance the current file position.

~\anaconda3\envs\dswh_env\lib\site-packages\torch\serialization.py in _open_file_like(name_or_buffer, mode) 228 def _open_file_like(name_or_buffer, mode): 229 if _is_path(name_or_buffer): --> 230 return _open_file(name_or_buffer, mode) 231 else: 232 if 'w' in mode:

~\anaconda3\envs\dswh_env\lib\site-packages\torch\serialization.py in init(self, name, mode) 209 class _open_file(_opener): 210 def init(self, name, mode): --> 211 super(_open_file, self).init(open(name, mode)) 212 213 def exit(self, *args):

FileNotFoundError: [Errno 2] No such file or directory: './checkpoints\pam\pam_net_F.pth'

gregjim avatar May 12 '21 08:05 gregjim

i have the same problem,do you solve it?could you help me? thank you. @gregjim

Z-Yh-June avatar Oct 09 '21 11:10 Z-Yh-June

I also encountered the same problem, how did you solve it? thanks.

0-xl-0 avatar Nov 27 '21 07:11 0-xl-0

Yes.. I think you must download the additional files and put in the correct locations

pam_net_F.pth

gregjim avatar Dec 07 '21 22:12 gregjim

hello dear i cannot download pam_net_F.pth file. do you have any link to download? or upload here. thanks

Saddam1235 avatar Feb 01 '22 09:02 Saddam1235

我好像把作者的这个下载下来了,但是忘记原链接了,我把我的链接给你吧 链接:https://pan.baidu.com/s/1bcvlsTdLWsNsekAn3diLkg 提取码:drwe

ZhaoRuu avatar Oct 10 '22 16:10 ZhaoRuu