HorizonNet icon indicating copy to clipboard operation
HorizonNet copied to clipboard

Assertion Error while training with custom datasets

Open lyzband opened this issue 4 years ago • 4 comments

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

lyzband avatar Jul 29 '19 08:07 lyzband

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.

sunset1995 avatar Jul 29 '19 10:07 sunset1995

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

lyzband avatar Jul 30 '19 09:07 lyzband

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.

sunset1995 avatar Jul 30 '19 09:07 sunset1995

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

lyzband avatar Jul 31 '19 09:07 lyzband