def test_plot_sample(verbose=False): conf = loader.default_conf.copy() myloader = loader.LocalSegmentationLoader() myvis = visualizer.LocalSegVisualizer(class_file=class_file, conf=conf) sample = myloader[1] if verbose: myvis.plot_sample(sample)
def test_plot_sample_2d(): conf = loader.default_conf.copy() conf['label_encoding'] = 'spatial_2d' conf['grid_dims'] = 2 conf['grid_size'] = 10 myloader = loader.LocalSegmentationLoader(conf=conf) myvis = visualizer.LocalSegVisualizer(class_file=class_file, conf=conf) sample = myloader[1] return myvis.plot_sample(sample)
def test_plot_sample(verbose=False): return conf = loader.default_conf.copy() myloader = loader.WarpingSegmentationLoader(lst_file='val') label_coder = LabelCoding(conf=conf) myvis = visualizer.LocalSegVisualizer(class_file=class_file, conf=conf, label_coder=label_coder) sample = myloader[1] if verbose: myvis.plot_sample(sample)
def test_scatter_plot_2d(): conf = loader.default_conf.copy() conf['label_encoding'] = 'spatial_2d' conf['grid_dims'] = 2 conf['grid_size'] = 10 myloader = loader.get_data_loader(conf=conf, batch_size=6, pin_memory=False, split='val') batch = next(myloader.__iter__()) myvis = visualizer.LocalSegVisualizer(class_file=class_file, conf=conf) label = batch['label'][0].numpy() prediction = np.random.random((label.shape)) - 0.5 + label myvis.scatter_plot(label=label, prediction=prediction)
def test_plot_batch_2d(): conf = loader.default_conf.copy() conf['label_encoding'] = 'spatial_2d' conf['grid_dims'] = 2 conf['grid_size'] = 10 myloader = loader.get_data_loader(conf=conf, batch_size=6, pin_memory=False, split='val') batch = next(myloader.__iter__()) myvis = visualizer.LocalSegVisualizer(class_file=class_file, conf=conf) start_time = time.time() return myvis.plot_batch(batch) duration = time.time() - start_time logging.info("Visualizing one batch took {} seconds".format(duration))
def test_plot_batch(verbose=False): conf = loader.default_conf.copy() conf['dataset'] = 'blender_mini' return myloader = loader.get_data_loader(conf=conf, batch_size=6, pin_memory=False, split='train') batch = next(myloader.__iter__()) myvis = visualizer.LocalSegVisualizer(class_file=class_file, conf=conf) if verbose: start_time = time.time() myvis.plot_batch(batch) duration = time.time() - start_time logging.info("Visualizing one batch took {} seconds".format(duration))
def test_plot_batch(verbose=False): return conf = loader.default_conf.copy() myloader = loader.get_data_loader(conf=conf, batch_size=6, pin_memory=False, split='train', lst_file='val') batch = next(myloader.__iter__()) label_coder = LabelCoding(conf=conf) myvis = visualizer.LocalSegVisualizer(class_file=class_file, conf=conf, label_coder=label_coder) if verbose: start_time = time.time() myvis.plot_batch(batch) duration = time.time() - start_time logging.info("Visualizing one batch took {} seconds".format(duration))
def test_loading_blender(verbose=False): conf = loader.default_conf.copy() conf["dataset"] = "blender_mini" conf['num_worker'] = 8 # conf['transform'] = loader.mytransform myloader = loader.get_data_loader( conf=conf, batch_size=8, pin_memory=False) for step, sample in enumerate(myloader): myvis = visualizer.LocalSegVisualizer( class_file=conf["vis_file"], conf=conf) start_time = time.time() myvis.plot_batch(sample) duration = time.time() - start_time # NOQA if step == 5: break if verbose: plt.show()