global args args = parse_args() interp_list = [cv.INTER_NEAREST, cv.INTER_LINEAR, cv.INTER_CUBIC, cv.INTER_LANCZOS4] def return_raw_image(dataset): dataset_raw = [] for image_features in dataset: image_raw = image_features['image'].numpy() image = tf.image.decode_jpeg(image_raw) dataset_raw.append(image) return dataset_raw fg_dataset = tfrecord_creator.read("fg", "./data/tfrecord/") bg_dataset = tfrecord_creator.read("bg", "./data/tfrecord/") a_dataset = tfrecord_creator.read("a", "./data/tfrecord/") fg_dataset = list(fg_dataset) bg_dataset = list(bg_dataset) a_dataset = list(a_dataset) # fg_raw = return_raw_image(fg_dataset) # bg_raw = return_raw_image(bg_dataset) # a_raw = return_raw_image(a_dataset) def get_raw(type_of_dataset, count): if type_of_dataset == 'fg': temp = fg_dataset[count]['image'] channels=3 elif type_of_dataset == 'bg': temp = bg_dataset[count]['image']
} def return_raw_image(dataset): dataset_raw = [] for image_features in dataset: image_raw = image_features['image'].numpy() image = tf.image.decode_jpeg(image_raw) dataset_raw.append(image) return dataset_raw # bg_dataset = tfrecord_creator.read("bg", "./data/tfrecord/") # bg_dataset = tfrecord_creator.read("bg", "../data/bg/") bg_dataset = tfrecord_creator.read("bg", "/content/bg/") bg_dataset = list(bg_dataset) print("___________________") print(len(bg_dataset)) print("___________________") def get_raw(type_of_dataset, count): if type_of_dataset == 'fg': temp = fg_dataset[count]['image'] channels = 3 elif type_of_dataset == 'bg': temp = bg_dataset[count]['image'] channels = 3 else: temp = a_dataset[count]['image']