-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UnboundLocalError: local variable 'x' referenced before assignment #8
Comments
Sorry for late response. The error seems to be caused by the version of mmsegmentation or invalid input data type or shape. Have you tried to reinstall mmsegmentation with recommended version and checked the input? |
Thanks for your response! btw |
@airparkchen hi, i get the same error and fix it. You can modify the code at class 'EfficientMultiheadAttention' from mit.py to "out = self.attn(query=x_q.permute(1,0,2), key=x_kv.permute(1,0,2), value=x_kv.permute(1,0,2), need_weights=False)[0].permute(1,0,2)". This error may a code bug or caused by the version of pytorch. You can obtain the correct input dimensions from torch.nn.MultiheadAttention. |
@binghui-z Sorry for late response. |
Thanks! |
Hi,I'm a student and very interested in your "3D Interacting Hand Pose Estimation by Hand De-occlusion and Removal" paper.
i'm getting error on running demo.py
(hdr_hope) C:\HDR>python demo/demo.py
load checkpoint from local path: ./demo_work_dirs/Interhand_seg/iter_237500.pth => loading checkpoint './demo_work_dirs/TDR_fintune/checkpoints\ckpt_iter_138000.pth.tar' => loading checkpoint './demo_work_dirs/All_train_SingleRightHand\checkpoints\ckpt_iter_261000.pth.tar' img.shape= torch.Size([1, 3, 256, 256]) Traceback (most recent call last): File "demo/demo.py", line 163, in <module> seg_result = inference_segmentor(seg_model, rgb.cuda()) File "C:\HDR\mmseg\apis\inference.py", line 168, in inference_segmentor seg_logits = model.encode_decode(img, None) File "C:\HDR\mmseg\models\segmentors\encoder_decoder.py", line 77, in encode_decode x = self.extract_feat(img) File "C:\HDR\mmseg\models\segmentors\encoder_decoder.py", line 73, in extract_feat return x UnboundLocalError: local variable 'x' referenced before assignment
i think maybe the problem is in "extract_feat" so i also post it on here
def extract_feat(self, img): """Extract features from images.""" # print(self.backbone(img)) # print(img) try: x = self.backbone(img) except : print("img.shape=", img.shape) if self.with_neck: x = self.neck(self.backbone(img))
The text was updated successfully, but these errors were encountered: