image_harmonization icon indicating copy to clipboard operation
image_harmonization copied to clipboard

jupyter tutorial cannot be run

Open LutaoChu opened this issue 3 years ago • 0 comments

Error:


---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
/tmp/ipykernel_19733/2885416576.py in <module>
      2 from iharm.inference.predictor import Predictor
      3 
----> 4 checkpoint_path = find_checkpoint(cfg.MODELS_PATH, 'hrnet_dih_001_adobe5k_last')
      5 # checkpoint_path = find_checkpoint(cfg.MODELS_PATH, 'hrnet18s_idih256')
      6 

~/image_harmonization/iharm/inference/utils.py in find_checkpoint(weights_folder, checkpoint_name)
     28     else:
     29         model_checkpoints = list(model_folder.rglob(f'{checkpoint_name}*.pth'))
---> 30         assert len(model_checkpoints) == 1
     31         checkpoint_path = model_checkpoints[0]
     32     return str(checkpoint_path)

Question 1: Where can I download the hrnet_ dih_ 001_ adobe5k_last model? Question 2: if the model is replaced with hrnet18s_ idih256,The following errors will be reported during load_model. How should I modify them?

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
/tmp/ipykernel_34762/4168270834.py in <module>
      5 checkpoint_path = find_checkpoint(cfg.MODELS_PATH, 'hrnet18s_idih256')
      6 
----> 7 net = load_model('hrnet_dih', checkpoint_path, verbose=True)
      8 # net = load_model('dih256', checkpoint_path, verbose=True)
      9 predictor = Predictor(net, device, with_flip=False)

~/image_harmonization/iharm/inference/utils.py in load_model(model_type, checkpoint_path, verbose)
      6 
      7 def load_model(model_type, checkpoint_path, verbose=False):
----> 8     net = ALL_MCONFIGS[model_type]['model'](**ALL_MCONFIGS[model_type]['params'])
      9     load_weights(net, checkpoint_path, verbose=verbose)
     10     return net

KeyError: 'hrnet_dih'

LutaoChu avatar Dec 21 '21 09:12 LutaoChu