Skip to content
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

AttributeError: 'Namespace' object has no attribute 'dataset' #1

Closed
xixihawokao opened this issue Mar 16, 2022 · 4 comments
Closed

Comments

@xixihawokao
Copy link

hi, i just follow readme/usage and type this conmand:
python inference.py --img_path demo/vg2.jpg --resume ckpt/checkpoint0149.pth
and i get this:

(scene_graph_benchmark) bash-4.2$ python inference.py --img_path demo/vg2.jpg --resume ckpt/checkpoint0149.pth
Namespace(aux_loss=True, backbone='resnet50', dec_layers=6, device='cuda', dilation=False, dim_feedforward=2048, dropout=0.1, enc_layers=6, hidden_dim=256, img_path='demo/vg2.jpg', lr_backbone=1e-05, nheads=8, num_entities=100, num_triplets=200, position_embedding='sine', pre_norm=False, resume='ckpt/checkpoint0149.pth', return_interm_layers=False)
yes
Traceback (most recent call last):
File "inference.py", line 191, in
main(args)
File "inference.py", line 104, in main
model = build_model(args)
File "/home/user/JL/myhome/juyterNotebook_folder/test/test_for_code/sgg_for_sgbEnv/reltr/RelTR-main/models/init.py", line 5, in build_model
return build(args)
File "/home/user/JL/myhome/juyterNotebook_folder/test/test_for_code/sgg_for_sgbEnv/reltr/RelTR-main/models/reltr.py", line 377, in build
num_classes = 151 if args.dataset != 'oi' else None #TODO: openimage v6
AttributeError: 'Namespace' object has no attribute 'dataset'

@CurtisDeCastro
Copy link

Same issue here

@yrcong
Copy link
Owner

yrcong commented Mar 20, 2022

Hi all,

sorry for the late reply. I got the point. The error is caused by the version change. Now I have fixed the inference code. Actually, nothing changed only adding some attributes for the initialization.

Now I can run inference.py successfully:) You could have a try now.

thanks for the update!

@xixihawokao
Copy link
Author

thanks!it’s nice job,but when i use this find another problem
my datasets is coco OpenEnded_mscoco_val2014_questions,
specially,for “COCO_val2014_000000339761.jpg”this picture,i get this:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Input In [9], in <cell line: 70>()
103 topk = 10
104 keep_queries = torch.nonzero(keep, as_tuple=True)[0]
--> 105 indices = torch.argsort(-probas[keep_queries].max(-1)[0] * probas_sub[keep_queries].max(-1)[0] * probas_obj[keep_queries].max(-1)[0])[:topk]
106 keep_queries = keep_queries[indices]
108 # use lists to store the outputs via up-values

RuntimeError: cannot perform reduction function max on tensor with no elements because the operation does not have an identity
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
There are other pictures that will do the same,could you please solve this [problem?this dataset is from (https://okvqa.allenai.org/download.html).

@yrcong
Copy link
Owner

yrcong commented Mar 22, 2022

The error shows no relationships above the threshold are found by RelTR.

When you are using a customized image or image from other datasets. It could be that the entities in the image are not included in the VG-150 classes (also relationships).

In this case, you could lower the threshold in Line137/138 (I set it to 0.3, for your example, I use 0.1 and get something interesting). However, the lower threshold means that RelTR is not confident in the output so there could be some dummy triplets.

I will also release the pre-trained model on OpenImages which contains more than 250 object categories in the future.

@yrcong yrcong closed this as completed Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants