Open shahaamirbader opened 2 years ago
Okay, so I did manage to resolve the error by replacing all the dictionary values as follows:
ckpt = torch.load('../../DenseTorch/ckpt/checkpoint.pth.tar')
pretrained_dict = ckpt['state_dict']
new_pretrained_dict = {key.replace("module.0.", ""): value for key, value in pretrained_dict.items()}
new_pretrained_dict = {key.replace("module.1.", ""): value for key, value in new_pretrained_dict.items()}
new_pretrained_dict = {key.replace("stem_convs.0", "conv8"): value for key, value in new_pretrained_dict.items()}
new_pretrained_dict = {key.replace("stem_convs.1", "conv7"): value for key, value in new_pretrained_dict.items()}
new_pretrained_dict = {key.replace("stem_convs.2", "conv6"): value for key, value in new_pretrained_dict.items()}
new_pretrained_dict = {key.replace("stem_convs.3", "conv5"): value for key, value in new_pretrained_dict.items()}
new_pretrained_dict = {key.replace("stem_convs.4", "conv4"): value for key, value in new_pretrained_dict.items()}
new_pretrained_dict = {key.replace("stem_convs.5", "conv3"): value for key, value in new_pretrained_dict.items()}
new_pretrained_dict = {key.replace("crp_blocks.0", "crp4"): value for key, value in new_pretrained_dict.items()}
new_pretrained_dict = {key.replace("crp_blocks.1", "crp3"): value for key, value in new_pretrained_dict.items()}
new_pretrained_dict = {key.replace("crp_blocks.2", "crp2"): value for key, value in new_pretrained_dict.items()}
new_pretrained_dict = {key.replace("crp_blocks.3", "crp1"): value for key, value in new_pretrained_dict.items()}
new_pretrained_dict = {key.replace("adapt_convs.0", "conv_adapt4"): value for key, value in new_pretrained_dict.items()}
new_pretrained_dict = {key.replace("adapt_convs.1", "conv_adapt3"): value for key, value in new_pretrained_dict.items()}
new_pretrained_dict = {key.replace("adapt_convs.2", "conv_adapt2"): value for key, value in new_pretrained_dict.items()}
new_pretrained_dict = {key.replace("heads.0.0", "pre_depth"): value for key, value in new_pretrained_dict.items()}
new_pretrained_dict = {key.replace("heads.0.2", "segm"): value for key, value in new_pretrained_dict.items()}
new_pretrained_dict = {key.replace("heads.1.0", "pre_segm"): value for key, value in new_pretrained_dict.items()}
new_pretrained_dict = {key.replace("heads.1.2", "depth"): value for key, value in new_pretrained_dict.items()}
#print("new state_dict keys: ", new_pretrained_dict.keys())
#model.load_state_dict(ckpt['state_dict'], strict=True)
model.load_state_dict(new_pretrained_dict)
but the output segmentation mask is not as accurate as authors provided pretrained model.
Hi, i was reading your documentation here https://github.com/DrSleep/DenseTorch/blob/dev/docs/Models.md, where it is mentioned that you have to used return and combine layers as return_idx = [1, 2, 3, 4, 5, 6] combine_layers = [[0, 1], [2, 3], 4, 5]
If we use Mobilenet+MTLWRefienet, what to use if i train a single heads seperately, i mean if i want to train depth head alone, what "return_idx" and "combine_layers" to use, and similarly to "segm" and "normals"
Great work. I have tried to train a NYUD joint network using default settings provided in the repo. The model is saved as checkpoint.pth.tar.
However, when running the inference using one of the notebook code from https://github.com/DrSleep/multi-task-refinenet/blob/master/src/notebooks/ExpNYUD_joint.ipynb, I get the subject error as follows:
I have tried replacing the module with "" as follows:
but the error doesnt go away. Any suggestion on how to address this error?
Using
strict=False
does make the code run without errors, but the prediction is incorrect and the predictions do not show anything at the output images