lucastabelini / PolyLaneNet

Code for the paper entitled "PolyLaneNet: Lane Estimation via Deep Polynomial Regression" (ICPR 2020)
https://arxiv.org/abs/2004.10924
MIT License
295 stars 74 forks source link

training tusimple error #3

Closed lzcchl closed 4 years ago

lzcchl commented 4 years ago

when I use “train.py”, set "tusimple.py" --> 'train': ['label_data_0313.json'], there are error as:


total annos 2858 Transforming annotations... Done. Loaded pretrained weights for efficientnet-b0 [2020-05-21 17:43:48,538] [INFO] Starting training. [2020-05-21 17:43:48,538] [INFO] Beginning epoch 1 [2020-05-21 17:43:50,452] [ERROR] Uncaught exception Traceback (most recent call last): File "train.py", line 237, in train_state=train_state, File "train.py", line 54, in train loss, loss_dict_i = criterion(outputs, labels, **criterion_parameters) File "/home/cuda/lzc/road/PolyLaneNet/lib/models.py", line 116, in loss lower_loss = mse(target_lowers[valid_lanes_idx], pred_lowers[valid_lanes_idx]) IndexError: The shape of the mask [64, 1] at index 0does not match the shape of the indexed tensor [80, 1] at index 0

but when I set "tusimple.py" --> 'train': ['label_data_0601.json'], then begin training.

lzcchl commented 4 years ago

why cannot use only one json for training?

lucastabelini commented 4 years ago

In label_data_0313.json, the maximum number of lanes in an image is 4. The model predicts this number of lanes. In the cfgs I provided, the number of outputs (num_outputs in the .yaml) is calculated for a maximum of 5 lanes. You have three options:

  1. Enforce the number of lanes predicted to be 5. I don't think this is a good option, since there are no images with 5 lanes in that JSON the model will learn to always say that there is no fifth lane. To do this, pass the option max_lanes: 5 in the training dataset settings (in the .yaml)
  2. Change the number of outputs to be compatible with 4 lanes. For 5 lanes, that number is 35, for 4 lanes, it would be 28 (there's an explanation of where that number comes from in each .yaml). To do this, set the parameter num_outputs: 28.
  3. Use the other train JSON (label_data_0601.json), which has images with 5 lanes.

I would go with option 3.

lzcchl commented 4 years ago

Thank you! That's help a lot, I will put some pics which only 3 lanes for training. so I change the number of outputs to 21, that works and begin training.