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

Assertion Error while training with custom datasets #8

Open
lyzband opened this issue Jul 29, 2019 · 4 comments
Open

Assertion Error while training with custom datasets #8

lyzband opened this issue Jul 29, 2019 · 4 comments

Comments

@lyzband
Copy link

lyzband commented Jul 29, 2019

I have tried to train this model with my own custom dataset but the following is the error I encountered.

The format of the dataset followed the one from the tutorial.
The images I used are 360 degree pictures of my room/office taken by myself and I have labeled the images without pre-processing(aligning camera rotation pose). Is this process necessary?

Looking forward to any suggestions.

Traceback (most recent call last): | 0/2 [00:00<?, ?it/s]
File "train.py", line 171, in
x, y_bon, y_cor = next(iterator_train)
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 582, in next
return self._process_next_batch(batch)
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 608, in _process_next_batch
raise batch.exc_type(batch.exc_msg)
AssertionError: Traceback (most recent call last):
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 99, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 99, in
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/ubuntu/Projects/HorizonNet_Original/dataset.py", line 68, in getitem
assert (cor[0::2, 1] > cor[1::2, 1]).sum() == 0
AssertionError

@sunset1995
Copy link
Owner

Thank you for using HorizonNet.

Actually your training images should be aligned and sorry for missing this step in tutorial. I just fixed it.
But as your dataset pass the sanity check assert (cor[0::2, 0] != cor[1::2, 0]).sum() == 0 in dataset.py, your original images could be already properly aligned.

From the error log you paste, it seem that the order of ceiling and floor corners in ground truth .txt files is flipped.

158 186      <= this is ceiling corner (smaller y position)
158 329      <= this is the corresponding floor corner
...

Ceiling corner should appear just right before the corresponding floor corner.

@lyzband
Copy link
Author

lyzband commented Jul 30, 2019

Thank you for your rapid feedback.
But the new commit does not work for me.

Before training with my own data, I wanted to try to test the new commit with some samples, which are from layoutnet_dataset.(I picked 8 samples from train folder) I labeled them with my own tool and let horizonNet train with them, however, it returns the same error as the following. I followed the the way your tutorial says but it seems like there are rule that I am missing when I label the images. I checked the order of my dataset, but it has been not flipped.

some of the data that I labeled are attached to this issue could you please check and tell me what is wrong?

Looking forward to hearing from you.

File "train.py", line 171, in
x, y_bon, y_cor = next(iterator_train)
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 582, in next
return self._process_next_batch(batch)
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 608, in _process_next_batch
raise batch.exc_type(batch.exc_msg)
AssertionError: Traceback (most recent call last):
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 99, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 99, in
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/ubuntu/Projects/HorizonNet_Original/dataset.py", line 67, in getitem
assert (cor[0::2, 1] > cor[1::2, 1]).sum() == 0
AssertionError

@sunset1995
Copy link
Owner

It seems that line 3 in some of your provided gt .txt is corrupted.

For example pano_ayqmegcknownei.txt:

179 195
179 318
260 318
260 314
460 197
460 364
647 314
647 359

It is unreasonable for corners 260 318 and 260 314.

Another easy to spot corrupted data pano_ayinqxoyulzbco.txt:

164 175
164 314
254 314
254 314
456 178
456 350
658 314
658 351

Line 3 and 4 are totally the same.

@lyzband
Copy link
Author

lyzband commented Jul 31, 2019

yeah you are right I found a typo from my own code.
after the fixation it is working fine
Thanks a lot!

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

2 participants