We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
作者您好,我在其他项目中加入您的车道线训练标签过程中,似乎因为DALI不支持多进程导致数据增强失败。所以,想问下您的车道线标签数据,是只能使用DALI增强,还是可以使用其他类似的库吗?最重要的是这里的labels要如何跟随图像的变换而变换呢?希望可以得到您的回复,非常感谢! def ExternalSourceTrainPipeline(batch_size, num_threads, device_id, external_data, train_width, train_height, top_crop, normalize_image_scale = False, nscale_w = None, nscale_h = None): pipe = Pipeline(batch_size, num_threads, device_id) with pipe: jpegs, seg_images, labels = fn.external_source(source=external_data, num_outputs=3) images = fn.decoders.image(jpegs, device="mixed") seg_images = fn.decoders.image(seg_images, device="mixed") if normalize_image_scale: images = fn.resize(images, resize_x=nscale_w, resize_y=nscale_h) seg_images = fn.resize(seg_images, resize_x=nscale_w, resize_y=nscale_h, interp_type=types.INTERP_NN) # make all images at the same size size = encoded_images_sizes(jpegs) center = size / 2 mt = fn.transforms.scale(scale = fn.random.uniform(range=(0.8, 1.2), shape=[2]), center = center) mt = fn.transforms.rotation(mt, angle = fn.random.uniform(range=(-6, 6)), center = center) off = fn.cat(fn.random.uniform(range=(-200, 200), shape = [1]), fn.random.uniform(range=(-100, 100), shape = [1])) mt = fn.transforms.translation(mt, offset = off) images = fn.warp_affine(images, matrix = mt, fill_value=0, inverse_map=False) seg_images = fn.warp_affine(seg_images, matrix = mt, fill_value=0, inverse_map=False) labels = fn.coord_transform(labels.gpu(), MT = mt) images = fn.resize(images, resize_x=train_width, resize_y=int(train_height/top_crop)) seg_images = fn.resize(seg_images, resize_x=train_width, resize_y=int(train_height/top_crop), interp_type=types.INTERP_NN) images = fn.crop_mirror_normalize(images, dtype=types.FLOAT, mean = [0.485 * 255, 0.456 * 255, 0.406 * 255], std = [0.229 * 255, 0.224 * 255, 0.225 * 255], crop = (train_height, train_width), crop_pos_x = 0., crop_pos_y = 1.) seg_images = fn.crop_mirror_normalize(seg_images, dtype=types.FLOAT, mean = [0., 0., 0.], std = [1., 1., 1.], crop = (train_height, train_width), crop_pos_x = 0., crop_pos_y = 1.) pipe.set_outputs(images, seg_images, labels) return pipe
def ExternalSourceTrainPipeline(batch_size, num_threads, device_id, external_data, train_width, train_height, top_crop, normalize_image_scale = False, nscale_w = None, nscale_h = None): pipe = Pipeline(batch_size, num_threads, device_id) with pipe: jpegs, seg_images, labels = fn.external_source(source=external_data, num_outputs=3) images = fn.decoders.image(jpegs, device="mixed") seg_images = fn.decoders.image(seg_images, device="mixed") if normalize_image_scale: images = fn.resize(images, resize_x=nscale_w, resize_y=nscale_h) seg_images = fn.resize(seg_images, resize_x=nscale_w, resize_y=nscale_h, interp_type=types.INTERP_NN) # make all images at the same size size = encoded_images_sizes(jpegs) center = size / 2 mt = fn.transforms.scale(scale = fn.random.uniform(range=(0.8, 1.2), shape=[2]), center = center) mt = fn.transforms.rotation(mt, angle = fn.random.uniform(range=(-6, 6)), center = center) off = fn.cat(fn.random.uniform(range=(-200, 200), shape = [1]), fn.random.uniform(range=(-100, 100), shape = [1])) mt = fn.transforms.translation(mt, offset = off) images = fn.warp_affine(images, matrix = mt, fill_value=0, inverse_map=False) seg_images = fn.warp_affine(seg_images, matrix = mt, fill_value=0, inverse_map=False) labels = fn.coord_transform(labels.gpu(), MT = mt) images = fn.resize(images, resize_x=train_width, resize_y=int(train_height/top_crop)) seg_images = fn.resize(seg_images, resize_x=train_width, resize_y=int(train_height/top_crop), interp_type=types.INTERP_NN) images = fn.crop_mirror_normalize(images, dtype=types.FLOAT, mean = [0.485 * 255, 0.456 * 255, 0.406 * 255], std = [0.229 * 255, 0.224 * 255, 0.225 * 255], crop = (train_height, train_width), crop_pos_x = 0., crop_pos_y = 1.) seg_images = fn.crop_mirror_normalize(seg_images, dtype=types.FLOAT, mean = [0., 0., 0.], std = [1., 1., 1.], crop = (train_height, train_width), crop_pos_x = 0., crop_pos_y = 1.) pipe.set_outputs(images, seg_images, labels) return pipe
The text was updated successfully, but these errors were encountered:
No branches or pull requests
作者您好,我在其他项目中加入您的车道线训练标签过程中,似乎因为DALI不支持多进程导致数据增强失败。所以,想问下您的车道线标签数据,是只能使用DALI增强,还是可以使用其他类似的库吗?最重要的是这里的labels要如何跟随图像的变换而变换呢?希望可以得到您的回复,非常感谢!
def ExternalSourceTrainPipeline(batch_size, num_threads, device_id, external_data, train_width, train_height, top_crop, normalize_image_scale = False, nscale_w = None, nscale_h = None): pipe = Pipeline(batch_size, num_threads, device_id) with pipe: jpegs, seg_images, labels = fn.external_source(source=external_data, num_outputs=3) images = fn.decoders.image(jpegs, device="mixed") seg_images = fn.decoders.image(seg_images, device="mixed") if normalize_image_scale: images = fn.resize(images, resize_x=nscale_w, resize_y=nscale_h) seg_images = fn.resize(seg_images, resize_x=nscale_w, resize_y=nscale_h, interp_type=types.INTERP_NN) # make all images at the same size size = encoded_images_sizes(jpegs) center = size / 2 mt = fn.transforms.scale(scale = fn.random.uniform(range=(0.8, 1.2), shape=[2]), center = center) mt = fn.transforms.rotation(mt, angle = fn.random.uniform(range=(-6, 6)), center = center) off = fn.cat(fn.random.uniform(range=(-200, 200), shape = [1]), fn.random.uniform(range=(-100, 100), shape = [1])) mt = fn.transforms.translation(mt, offset = off) images = fn.warp_affine(images, matrix = mt, fill_value=0, inverse_map=False) seg_images = fn.warp_affine(seg_images, matrix = mt, fill_value=0, inverse_map=False) labels = fn.coord_transform(labels.gpu(), MT = mt) images = fn.resize(images, resize_x=train_width, resize_y=int(train_height/top_crop)) seg_images = fn.resize(seg_images, resize_x=train_width, resize_y=int(train_height/top_crop), interp_type=types.INTERP_NN) images = fn.crop_mirror_normalize(images, dtype=types.FLOAT, mean = [0.485 * 255, 0.456 * 255, 0.406 * 255], std = [0.229 * 255, 0.224 * 255, 0.225 * 255], crop = (train_height, train_width), crop_pos_x = 0., crop_pos_y = 1.) seg_images = fn.crop_mirror_normalize(seg_images, dtype=types.FLOAT, mean = [0., 0., 0.], std = [1., 1., 1.], crop = (train_height, train_width), crop_pos_x = 0., crop_pos_y = 1.) pipe.set_outputs(images, seg_images, labels) return pipe
The text was updated successfully, but these errors were encountered: