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

AssertionError: Non-existent Key: train.dataset #2

Closed
jinglan0829 opened this issue Dec 17, 2019 · 12 comments
Closed

AssertionError: Non-existent Key: train.dataset #2

jinglan0829 opened this issue Dec 17, 2019 · 12 comments

Comments

@jinglan0829
Copy link

感谢作者提供的干净版本的pvnet! 当我运行了python run.py --type visualize --cfg_file configs/linemod.yaml train.datset CustomTrain test.dataset CustomTrain model mycat这个以后,出现了这种error, AssertionError: Non-existent Key: train.dataset,该如何解决呢?

@pengsida
Copy link
Member

你字打错了 train.datset -> train.dataset

@jinglan0829
Copy link
Author

我直接复制粘贴了,不好意思呀,没仔细看

@jinglan0829
Copy link
Author

image 出来的结果不太对呀,自己数据集的train.json文件该如何获取呢?

@pengsida
Copy link
Member

第一个问题:#1
第二个问题:https://github.com/zju3dv/clean-pvnet#training-on-the-custom-object

@ykim104
Copy link

ykim104 commented Dec 17, 2019

I get this error when using custom dataset :(
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:103: void cunn_SpatialClassNLLCriterion_updateOutput_kernel(T *, T *, T *, long *, T *, int, int, int, int, int, long) [with T = float, AccumT = float]: block: [0,0,0], thread: [677,0,0] Assertiont >= 0 && t < n_classesfailed.
This happens when I call the dataloader - it might be that the computed annotations are outside [0,1) boundary? Potentially during interpolation?

It doesn't happen all the time for every image, but often enough.
I could't locate where you compute vector field annotation - can you give me a hint?

Thank you in advance and thank you for publishing this repo!

@pengsida
Copy link
Member

I will check this problem.

@pengsida
Copy link
Member

pengsida commented Dec 17, 2019

Vector field: https://github.com/zju3dv/clean-pvnet/blob/master/lib/datasets/linemod/pvnet.py#L53
This problem is probably caused by segmentation.

@ykim104
Copy link

ykim104 commented Dec 17, 2019

yes i found out that I get error here seg_loss = self.seg_crit(output['seg'], mask)

thank you!

@pengsida
Copy link
Member

The mask contains other values?

@ykim104
Copy link

ykim104 commented Dec 17, 2019

Yess!! I had 255 instead 1's in my mask!
I also used ObjectDatasetTool but my masks were 2D
so I edited read_linemod_mask() in pvnet_data_utils.py :D

Thank you for your help!!!
if ann_type == 'real': try: return (np.asarray(Image.open(path))[:, :, 0] != 0).astype(np.uint8) # custom/custom mask return 3d matrix except: return (np.asarray(Image.open(path))).astype(np.uint8)/255.

@ykim104
Copy link

ykim104 commented Dec 17, 2019

It works now!!! Thank you!

By the way, I also made few edits so I can have multiple object dataset inside custom folder. :D

@pengsida
Copy link
Member

pengsida commented Dec 17, 2019

(np.asarray(Image.open(path)) != 0).astype(np.uint8) is a more safe way, since the background value is zero in most cases.
You could additionally define a custom dataloader for your dataset according to https://github.com/zju3dv/clean-pvnet/blob/master/project_structure.md
I feel happy if this project facilitates your work!

@Ji-Hu Ji-Hu mentioned this issue Mar 9, 2020
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