I am learning pytorch… i have to implement this model from github…please someone guide me to implement it… it has different python functions… how to run this?
please…kindly help me…
I am learning pytorch… i have to implement this model from github…please someone guide me to implement it… it has different python functions… how to run this?
please…kindly help me…
Could you describe the issues you are facing or where exactly you are stuck?
The repository seems to describe how to execute the model so are you stuck at executing any Python code? If so, I would recommend to take a look at a (free) beginner course to get familiar with Python a bit more.
thank you, i have done basic data science and ANN in tensorflow… this one is in pytorch…
what i did was that imported this repository into colab and then executed the commands as mentioned in the description but its now working.
The first command is
model = network.modeling.dict[deeplabv3_resnet50](num_classes=NUM_CLASSES, output_stride=OUTPUT_SRTIDE)
the error:
NameError: name ‘network’ is not defined
but i have installed network using pip3.
I do not have deep knowledge in python… as you suggested i will go through python tutorials. but can you give a brief sketch of how to execute this?
I have understood how to predict single image, multiple images, run main.py ,VOC, cityscapes…
i have not understood how and where to run step 2,3
model = network.modeling.dict[MODEL_NAME](num_classes=NUM_CLASSES, output_stride=OUTPUT_SRTIDE) model.load_state_dict( torch.load( PATH_TO_PTH )[‘model_state’] )
outputs = model(images) preds = outputs.max(1)[1].detach().cpu().numpy() colorized_preds = val_dst.decode_target(preds).astype(‘uint8’) # To RGB images, (N, H, W, 3), ranged 0~255, numpy array # Do whatever you like here with the colorized segmentation maps colorized_preds = Image.fromarray(colorized_preds[0]) # to PIL Image
The network
namespace is defined in the repository directly here so you might need to change the working directory in order to import
it.
thank you, i have run the following
–model = network.modeling.dict[‘deeplabv3_mobilenet’](num_classes=NUM_CLASSES, output_stride=OUTPUT_STRIDE)
it imported the corresponding pth file. Now in the next line of code, wehave to load it along with the model state. i did the following.
–model_state=model.state_dict()
–checkpoint=torch.load(‘/root/.cache/torch/hub/checkpoints/mobilenet_v2-b0353104.pth’)
–model.load_state_dict(checkpoint[‘model_state’])
for this line of code. I am getting the following error:
----> 3 model.load_state_dict(checkpoint[‘model_state’])
KeyError: ‘model_state’
what to do now…