CFCNet icon indicating copy to clipboard operation
CFCNet copied to clipboard

Pretained NYU error

Open haozhen315 opened this issue 4 years ago • 3 comments

I downloaded the pretrained nyu weights (500.pth), and edited line 138 of base_model.py to

state_dict = torch.load('.../500.pth', map_location=str(self.device))

When I run python evaluate.py --name nyu --checkpoints_dir ... --train_path ~/nyudepthv2/nyudepthv2/val/ --test_path ~/nyudepthv2/nyudepthv2/val/

I get:

           batch_size: 16                            
      checkpoints_dir: /home/haozhen/Downloads/500.pth	[default: ./checkpoints]
       continue_train: False                         
                epoch: latest                        
          epoch_count: 1                             
              gpu_ids: 0                             
            init_gain: 0.02                          
            init_type: xavier                        
              isTrain: False                         	[default: None]
                   lr: 0.001                         
      lr_decay_epochs: 100                           
       lr_decay_iters: 5000000                       
             lr_gamma: 0.9                           
            lr_policy: lambda                        
     max_dataset_size: inf                           
                model: DCCA_sparse                   
             momentum: 0.9                           
                   nP: 500                           
                 name: nyu                           	[default: experiment_name]
                niter: 400                           
              no_flip: True                          
                 norm: instance                      
          num_threads: 8                             
                phase: train                         
           print_freq: 1                             
       resize_or_crop: none                          
      save_epoch_freq: 1                             
                 seed: 0                             
       serial_batches: False                         
               suffix:                               
            test_path: /home/haozhen/Documents/nyudepthv2/val	[default: None]
           train_path: /home/haozhen/Documents/nyudepthv2/val	[default: None]
              verbose: False                         
         weight_decay: 0.0005                        

----------------- End ------------------- Found 654 images in val folder. #test images = 654 initialize network with xavier initialize network with xavier model [DCCASparseNetModel] was created loading the model from /home/haozhen/Downloads/500.pth/nyu/latest_net_DCCASparseNet.pth ---------- Networks initialized ------------- [Network DCCASparseNet] Total number of parameters : 40.417 M

torch.Size([1, 6, 224, 224]) torch.Size([1, 1, 224, 224]) Traceback (most recent call last): File "/home/haozhen/codes/CFCNet/evaluate.py", line 99, in model.set_new_input(data,target) File "/home/haozhen/codes/CFCNet/models/DCCA_sparse_model.py", line 68, in set_new_input self.mask = input[:,7,:,:].to(self.device).unsqueeze(1) IndexError: index 7 is out of bounds for dimension 1 with size 6

haozhen315 avatar Oct 13 '20 07:10 haozhen315

I also encountered this problem, is it solved?

NaCl96 avatar Nov 19 '20 08:11 NaCl96

Hi, what is your shapes of "data" and "target" in line 97 of evaluation.py

choyingw avatar Nov 23 '20 03:11 choyingw

@choyingw data.shape = torch.Size([1, 6, 224, 224]) target.shape = torch.Size([1, 1, 224, 224])

aaj22 avatar Jul 05 '21 21:07 aaj22