cfzd / Ultra-Fast-Lane-Detection

Ultra Fast Structure-aware Deep Lane Detection (ECCV 2020)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Labelling our own data

KaiTang98 opened this issue · comments

commented

May I ask for any advice such that

How could we make our own data for training this network?

Thanks a lot.

commented

@KaiTang98
The most convenient way might be: label your data like CULane, and use the labeled data to train the model as the CULane ways.

commented

Thank you for your reply cfzd. Before I want to try my labeled data, I first try to use CULane but with setting the num_lanes in culane.py equal to 1 or 2 or 3. However, I found that all this case didn't work with the error:

Exception has occurred: RuntimeError
CUDA error: device-side assert triggered
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.
File "C:\Users\kaita\Ultra-Fast-Lane-Detection\utils\dist_utils.py", line 142, in add_scalar
super(DistSummaryWriter, self).add_scalar(*args, **kwargs)
File "C:\Users\kaita\Ultra-Fast-Lane-Detection\train.py", line 56, in calc_loss
logger.add_scalar('loss/'+loss_dict['name'][i], loss_cur, global_step)
File "C:\Users\kaita\Ultra-Fast-Lane-Detection\train.py", line 74, in train
loss = calc_loss(loss_dict, results, logger, global_step)
File "C:\Users\kaita\Ultra-Fast-Lane-Detection\train.py", line 156, in
train(net, train_loader, loss_dict, optimizer, scheduler,logger, epoch, metric_dict, cfg.use_aux)
RuntimeError: CUDA error: device-side assert triggered
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.

Could you give me some advice? Many thanks.

commented

@KaiTang98
The error CUDA error: device-side assert triggered usually means that the number of classess in GT exceeds the number of classes of the network. For example, you have a 5-class classification network, however, the GT contains a class label of 7. This will trigger the error.

commented

Thank you for your kind reply. You are right, the number of classess in GT should smaller than the number of classes of the network.

Then I decide to create my own label to check if it works in your framework. May I ask why each line of the train_gt.txt is structured like this: img label 1 1 1. I checked the part to load the training data, it seems that this code only reads the image and the label without using the rest of the information (1 1 1 1). Could you give me a hint? Is this information used in other parts, and should I create my custom train_gt.txt file following this layout? Many thanks.

commented

@KaiTang98
In fact, we get the information of (1 1 1 1) from the segmentation map. This label matches the segmentation label exactly. For example, if a segmentation map has id label of (2,3), then the label would be (0 1 1 0). The code can be found here:

all_idx = np.zeros((self.num_lanes,len(sample_tmp),2))
for i,r in enumerate(sample_tmp):
label_r = np.asarray(label)[int(round(r))]
for lane_idx in range(1, self.num_lanes + 1):
pos = np.where(label_r == lane_idx)[0]
if len(pos) == 0:
all_idx[lane_idx - 1, i, 0] = r
all_idx[lane_idx - 1, i, 1] = -1
continue
pos = np.mean(pos)
all_idx[lane_idx - 1, i, 0] = r
all_idx[lane_idx - 1, i, 1] = pos

The lane_idx is what you want.

commented

Thanks for your reply. Yeah, that's what I am talking about such that the code doesn't use the lane label in train_gt.txt file, but calculates the lane index every time when the trained image is loaded. But anyway, I think I had a better understanding of this amazing method. Thank you so much.

commented

You are welcome. : )

@KaiTang98 The most convenient way might be: label your data like CULane, and use the labeled data to train the model as the CULane ways.

hi , you can teach me how to label CULane data, what tool to label this, tks you very much

Thanks for your reply. Yeah, that's what I am talking about such that the code doesn't use the lane label in train_gt.txt file, but calculates the lane index every time when the trained image is loaded. But anyway, I think I had a better understanding of this amazing method. Thank you so much.

hi , you can teach me how to label CULane data, what tool to label this, tks you very much