hkchengrex/CascadePSP

Error while running demo code!!

Guttappa1238 opened this issue · 4 comments

Hi,

I installed pip package using this pip install segmentation-refinement and when i run demo code

import cv2
import time
import matplotlib.pyplot as plt
import segmentation_refinement as refine
image = cv2.imread('test/aeroplane.jpg')
mask = cv2.imread('test/aeroplane.png', cv2.IMREAD_GRAYSCALE)

# model_path can also be specified here
# This step takes some time to load the model
refiner = refine.Refiner(device='cuda:0') # device can also be 'cpu'

# Fast - Global step only.
# Smaller L -> Less memory usage; faster in fast mode.
output = refiner.refine(image, mask, fast=False, L=900) 

# this line to save output
cv2.imwrite('output.png', output)

plt.imshow(output)
plt.show()

I got this error

magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, '<'.

Please help me!!

Model downloading probably failed. You can download it manually and point the path to it. See

def __init__(self, device='cpu', model_folder=None):

@hkchengrex thank you, because of model not downloaded successfully i got that error but my question is that why its failed to download you know any reason?

There can be many reasons. Network failure, canceling mid-download, or just google drive not collaborating. The code is in no way robust to these situations.

What arguments did you pass refine? I passed my path to my downloaded model and the error still occurred for me.