From ed5a6f2cdbad1d8cc31901ae7f1e7e2386b910b3 Mon Sep 17 00:00:00 2001 From: bjoern Date: Mon, 6 Nov 2023 16:40:11 +0000 Subject: [PATCH] more cleanup --- README.md | 2 + atman-magma/atman_magma/openimages_eval.py | 3 +- atman-magma/eval_openimages.py | 96 - atman-magma/example_explain_panda_captum.py | 3 +- atman-open-images-eval/.gitignore | 8 - atman-open-images-eval/README.md | 32 - atman-open-images-eval/config.yml | 20 - .../multimodal_explain_eval/__init__.py | 0 .../multimodal_explain_eval/api.py | 100 - .../multimodal_explain_eval/classes.py | 352 --- .../multimodal_explain_eval/data_prep.py | 162 - .../multimodal_explain_eval/dataloader.py | 109 - .../multimodal_explain_eval/dataset.py | 132 - .../multimodal_explain_eval/eval.py | 212 -- .../multimodal_explain_eval/utils.py | 322 -- atman-open-images-eval/prep_data.py | 71 - atman-open-images-eval/requirements.in | 6 - atman-open-images-eval/requirements.txt | 350 -- atman-open-images-eval/run.py | 100 - atman-open-images-eval/setup.py | 31 - atman-open-images-eval/setup.sh | 5 - determined/determined_eval_wrapper.py | 32 - determined/metadata.json | 2802 ----------------- determined/run_atman.yml | 48 - determined/run_atman_layers.yml | 43 - determined/run_eval.py | 120 - startup-hook.sh | 1 - 27 files changed, 4 insertions(+), 5158 deletions(-) delete mode 100755 atman-magma/eval_openimages.py delete mode 100755 atman-open-images-eval/.gitignore delete mode 100755 atman-open-images-eval/README.md delete mode 100755 atman-open-images-eval/config.yml delete mode 100755 atman-open-images-eval/multimodal_explain_eval/__init__.py delete mode 100755 atman-open-images-eval/multimodal_explain_eval/api.py delete mode 100755 atman-open-images-eval/multimodal_explain_eval/classes.py delete mode 100755 atman-open-images-eval/multimodal_explain_eval/data_prep.py delete mode 100755 atman-open-images-eval/multimodal_explain_eval/dataloader.py delete mode 100755 atman-open-images-eval/multimodal_explain_eval/dataset.py delete mode 100755 atman-open-images-eval/multimodal_explain_eval/eval.py delete mode 100755 atman-open-images-eval/multimodal_explain_eval/utils.py delete mode 100755 atman-open-images-eval/prep_data.py delete mode 100755 atman-open-images-eval/requirements.in delete mode 100755 atman-open-images-eval/requirements.txt delete mode 100755 atman-open-images-eval/run.py delete mode 100755 atman-open-images-eval/setup.py delete mode 100755 atman-open-images-eval/setup.sh delete mode 100755 determined/determined_eval_wrapper.py delete mode 100755 determined/metadata.json delete mode 100755 determined/run_atman.yml delete mode 100755 determined/run_atman_layers.yml delete mode 100755 determined/run_eval.py diff --git a/README.md b/README.md index 45d8105..7b2990c 100755 --- a/README.md +++ b/README.md @@ -24,6 +24,8 @@ bash startup-hook.sh ``` Note: further model-checkpoints will be downloaded when executing for the first time. Sometimes CLIP fails to verify on the first execution -> running again works usually. +The main folders are atman-magma, for all XAI implementations on the MAGMA model, and BLIP for all XAI implementations on the BLIP model. + # examples with MAGMA ``` cd atman-magma diff --git a/atman-magma/atman_magma/openimages_eval.py b/atman-magma/atman_magma/openimages_eval.py index 875c255..e04069d 100755 --- a/atman-magma/atman_magma/openimages_eval.py +++ b/atman-magma/atman_magma/openimages_eval.py @@ -3,7 +3,6 @@ from PIL import Image from typing import Callable -from multimodal_explain_eval.utils import check_if_a_or_an_and_get_prefix from magma.image_input import ImageInput from .utils import create_folder_if_does_not_exist @@ -100,7 +99,7 @@ def run_eval( prompt = [ input_image, - text_prompt + check_if_a_or_an_and_get_prefix(word=data["label"]), + text_prompt + "a ", ] if use_lowercase_target == True: diff --git a/atman-magma/eval_openimages.py b/atman-magma/eval_openimages.py deleted file mode 100755 index 7e28f5d..0000000 --- a/atman-magma/eval_openimages.py +++ /dev/null @@ -1,96 +0,0 @@ -from atman_magma.magma import Magma -from atman_magma.explainer import Explainer -from atman_magma.logit_parsing import get_delta_cross_entropies -from atman_magma.openimages_eval import run_eval - - -from multimodal_explain_eval.dataloader import DataLoader -from multimodal_explain_eval.utils import load_json_as_dict - -import yaml - -with open("config.yml", "r") as stream: - config = yaml.safe_load(stream) - -conc_sup_values = config["hyperparams"]["conc_sup_values"] -suppression_factor_values = config["hyperparams"]["suppression_factor_values"] - - -metadata = load_json_as_dict( - filename = config['files']['metadata_filename'] -) - -keys_to_delete = [] -for x in metadata.keys(): - if metadata[x]['count'] == 0: - keys_to_delete.append(x) - -for key in keys_to_delete: - del metadata[key] - - -dataloader = DataLoader( - metadata=metadata -) - -num_images = 0 -for key in metadata: - num_images += metadata[key]["count"] - # print(f"{key:<17}:", metadata[key]["count"]) - -print(f"total {num_images} pairs across {len(metadata)} classes") - -num_total_explanations = ( - len(conc_sup_values) * len(suppression_factor_values) * num_images -) -print(f"Will run a total of: {num_total_explanations} explanations") - -print('output folder names:') -folder_names = [] -for x in conc_sup_values: - for y in suppression_factor_values: - folder_name = f"{config['files']['output_dir']}/con_sup_thres_{round(x, 2) if x is not None else None}_suppression_factor_{round(y, 2) if y is not None else None}" - print(folder_name) - folder_names.append( - folder_name - ) - -print('loading model...') -model = Magma.from_checkpoint( - checkpoint_path = config['model']['checkpoint_path'], - device = config['model']['device'] -) - -folder_idx = 0 - -for conceptual_suppression_threshold in conc_sup_values: - for suppression_factor in suppression_factor_values: - - ex = Explainer( - model = model, - device = config['model']['device'], - tokenizer = model.tokenizer, - conceptual_suppression_threshold = conceptual_suppression_threshold, - suppression_factor = suppression_factor - ) - - run_eval( - explainer = ex, - metadata = metadata, - dataloader = dataloader, - logit_parsing_fn=get_delta_cross_entropies, - output_folder = folder_names[folder_idx], - max_batch_size = config['model']['max_batch_size'], - text_prompt = config['hyperparams']['prompt_text'], - use_lowercase_target=True, - auto_decide_a_or_an=True, - progress=True, - square_outputs = False, - num_total_explanations=num_total_explanations, - prompt_explain_indices = [i for i in range(144)], - save_configs_only=config['hyperparams']['save_configs_only'], - save_configs_dir='./configs' - ) - folder_idx += 1 - -print('eval complete :)') \ No newline at end of file diff --git a/atman-magma/example_explain_panda_captum.py b/atman-magma/example_explain_panda_captum.py index f883660..05cbc95 100755 --- a/atman-magma/example_explain_panda_captum.py +++ b/atman-magma/example_explain_panda_captum.py @@ -4,7 +4,6 @@ from atman_magma.captum_helper import ( CaptumMagma, ) -from multimodal_explain_eval.utils import check_if_a_or_an_and_get_prefix import numpy as np from atman_magma.magma import Magma from magma.image_input import ImageInput @@ -39,7 +38,7 @@ att_combined = np.zeros((12,12)) for i in range(len(label_tokens)): - text_prompt = f"This is a picture of {check_if_a_or_an_and_get_prefix(targets.lower())} " + text_prompt = f"This is a picture of a " if i >= 1: text_prompt += model.tokenizer.decode(label_tokens[:i]) diff --git a/atman-open-images-eval/.gitignore b/atman-open-images-eval/.gitignore deleted file mode 100755 index b752e22..0000000 --- a/atman-open-images-eval/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -.ipynb_checkpoints/ -*.ipynb -RESULTS/ -__pycache__/ -*.jpg -.vscode/ -*.zip -*.json diff --git a/atman-open-images-eval/README.md b/atman-open-images-eval/README.md deleted file mode 100755 index 73a775d..0000000 --- a/atman-open-images-eval/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# atman-open-images-eval - -evaluating ATMAN's performance on the open-images-v6 segmentation dataset - - -# installation - -1. Make sure torch, torchvision and cudatoolkit are installed and working - -2. Install the Aleph-Alpha Transformer codebase [as shown here](https://gitlab.aleph-alpha.de/research/transformer#install-as-package) - -2. install dependencides - -``` -pip install pip-tools ## optional -pip install -r requirements.txt -``` - -# running with generator codebase - -By default, it uses this metadata: `metadata/all_classes_max_200_per_class.json` - -``` -python3 example_no_api.py -``` - -# add new requirements - -Add the new requirement to requirements.in and then run: -``` -pip-compile requirements.in -``` \ No newline at end of file diff --git a/atman-open-images-eval/config.yml b/atman-open-images-eval/config.yml deleted file mode 100755 index ae886ba..0000000 --- a/atman-open-images-eval/config.yml +++ /dev/null @@ -1,20 +0,0 @@ -logfile: "logs_30b.log" -hyperparams: - conc_sup_values: - - 0.6 - suppression_factor_values: - - 0.1 - prompt_text: 'This is a picture of ' - -files: - result_dir: '/temp_30b' ## remove the trailing "/" - raw_jsons_folder: "/temp_json_30b" - metadata_filename: 'metadata/all_classes_max_200_per_class.json' - -generator: - tokenizer_file: "alpha-001-128k.json" - checkpoint_dir: "/nfs/scratch/data_tmp/aa-alpha-001-128k-multilingual-data-alpha-1_30B_magma/global_step100000/" - pipe_parallel_size: 4 - max_batch_size: 200 # edit this to be as big as possible - normalize : false - square_outputs : false diff --git a/atman-open-images-eval/multimodal_explain_eval/__init__.py b/atman-open-images-eval/multimodal_explain_eval/__init__.py deleted file mode 100755 index e69de29..0000000 diff --git a/atman-open-images-eval/multimodal_explain_eval/api.py b/atman-open-images-eval/multimodal_explain_eval/api.py deleted file mode 100755 index 5aa9a0c..0000000 --- a/atman-open-images-eval/multimodal_explain_eval/api.py +++ /dev/null @@ -1,100 +0,0 @@ -import json -import requests -import numpy as np -import matplotlib.pyplot as plt - -def complete( - api_token, - prompt="Markus likes steak", - maximum_tokens=20, - model="luminous-extended", - url="https://test.api.aleph-alpha.com/complete", -): - - payload = json.dumps( - {"model": model, "prompt": prompt, "maximum_tokens": maximum_tokens} - ) - - headers = { - "Authorization": f"Bearer {api_token}", - "Content-Type": "application/json", - } - - response = requests.post(url, headers=headers, data=payload) - return response.json() - - -def explain( - api_token, - prompt="Markus likes steak", - target=" and fries", - directional=False, - suppression_factor=0.1, - conceptual_suppression_threshold=0.8, - model="luminous-extended", - url="https://api.aleph-alpha.com/explain", -): - - payload = json.dumps( - { - "model": model, - "prompt": prompt, - "target": target, - "directional": directional, - "suppression_factor": suppression_factor, - "conceptual_suppression_threshold": conceptual_suppression_threshold, - } - ) - - headers = { - "Authorization": f"Bearer {api_token}", - "Content-Type": "application/json", - } - - response = requests.post(url, headers=headers, data=payload) - return response.json() - - -def visualize_result_text( - result, - target_token_index=0, - prompt_start_index=None, - prompt_end_index=None, - width=20, - height=10, - topk=None, - fontsize=22, - save_as="output.jpg", - xticks_rotation=0, -): - - selected_result = result["result"][target_token_index] - explanations = selected_result["explanations"][prompt_start_index:prompt_end_index] - target_token = selected_result["target_token_str"] - - assert ( - len(explanations) != 0 - ), "length of explanations is 0, you probably cropped it too much" - - prompt_tokens = [ - f'{i}:{explanations[i]["token_str"]}' for i in range(len(explanations)) - ] - - values = [explanations[i]["value"] for i in range(len(explanations))] - - if topk is not None: - indices = np.argsort(np.array(values)).astype(int)[::-1] - values = np.take(values, indices)[:topk] - prompt_tokens = np.take(prompt_tokens, indices)[:topk] - - fig = plt.figure(figsize=(width, height)) - plt.title(f"target: {target_token}", fontsize=fontsize) - plt.bar( - prompt_tokens, - values, - ) - plt.tick_params(axis="x", rotation=xticks_rotation) - plt.xticks(fontsize=fontsize) - plt.grid() - - fig.savefig(save_as) diff --git a/atman-open-images-eval/multimodal_explain_eval/classes.py b/atman-open-images-eval/multimodal_explain_eval/classes.py deleted file mode 100755 index 23a1f6c..0000000 --- a/atman-open-images-eval/multimodal_explain_eval/classes.py +++ /dev/null @@ -1,352 +0,0 @@ -openimages_v6_segmentation_classes = [ - "Adhesive tape", - "Aircraft", - "Airplane", - "Alarm clock", - "Alpaca", - "Ambulance", - "Apple", - "Armadillo", - "Artichoke", - "Axe", - "Backpack", - "Bagel", - "Balance beam", - "Ball", - "Balloon", - "Banana", - "Band-aid", - "Barge", - "Barrel", - "Baseball bat", - "Baseball glove", - "Bat (Animal)", - "Beaker", - "Bear", - "Beer", - "Bell pepper", - "Belt", - "Bicycle wheel", - "Billiard table", - "Binoculars", - "Bird", - "Blue jay", - "Bomb", - "Book", - "Boot", - "Bottle", - "Bottle opener", - "Bowl", - "Box", - "Boy", - "Bread", - "Briefcase", - "Broccoli", - "Bronze sculpture", - "Brown bear", - "Bull", - "Burrito", - "Bus", - "Bust", - "Cabbage", - "Cake", - "Calculator", - "Camel", - "Camera", - "Canary", - "Candle", - "Canoe", - "Cantaloupe", - "Car", - "Carnivore", - "Carrot", - "Cat", - "Cattle", - "Cello", - "Cheese", - "Cheetah", - "Chest of drawers", - "Chicken", - "Chisel", - "Chopsticks", - "Christmas tree", - "Clock", - "Clothing", - "Cocktail", - "Cocktail shaker", - "Coffee", - "Coffee cup", - "Coin", - "Common fig", - "Common sunflower", - "Computer keyboard", - "Computer mouse", - "Cookie", - "Cooking spray", - "Corded phone", - "Couch", - "Cowboy hat", - "Cricket ball", - "Crocodile", - "Croissant", - "Cucumber", - "Dagger", - "Diaper", - "Dice", - "Digital clock", - "Dog", - "Dog bed", - "Dolphin", - "Door handle", - "Doughnut", - "Dress", - "Drill (Tool)", - "Drink", - "Drinking straw", - "Duck", - "Dumbbell", - "Eagle", - "Elephant", - "Envelope", - "Eraser", - "Facial tissue holder", - "Falcon", - "Fedora", - "Filing cabinet", - "Fire hydrant", - "Fish", - "Flag", - "Flashlight", - "Flower", - "Flowerpot", - "Flute", - "Flying disc", - "Food processor", - "Football", - "Fox", - "Frog", - "Frying pan", - "Garden Asparagus", - "Giraffe", - "Girl", - "Glove", - "Goat", - "Goldfish", - "Golf ball", - "Goose", - "Grape", - "Grapefruit", - "Guacamole", - "Guitar", - "Hair dryer", - "Hair spray", - "Hamburger", - "Hammer", - "Hamster", - "Hand dryer", - "Handbag", - "Handgun", - "Harbor seal", - "Harmonica", - "Harpsichord", - "Hat", - "Heater", - "Hedgehog", - "High heels", - "Hippopotamus", - "Horse", - "Hot dog", - "Human body", - "Human ear", - "Human mouth", - "Ipod", - "Jaguar (Animal)", - "Jeans", - "Jet ski", - "Jug", - "Juice", - "Kangaroo", - "Kettle", - "Kitchen knife", - "Kite", - "Knife", - "Koala", - "Ladle", - "Laptop", - "Lemon", - "Leopard", - "Light switch", - "Lighthouse", - "Limousine", - "Lion", - "Lipstick", - "Lizard", - "Loveseat", - "Luggage and bags", - "Lynx", - "Magpie", - "Man", - "Mango", - "Maracas", - "Measuring cup", - "Microwave oven", - "Milk", - "Miniskirt", - "Missile", - "Mixing bowl", - "Mobile phone", - "Monkey", - "Motorcycle", - "Mouse", - "Muffin", - "Mug", - "Mule", - "Mushroom", - "Nail (Construction)", - "Orange", - "Ostrich", - "Otter", - "Oven", - "Owl", - "Oyster", - "Pancake", - "Panda", - "Paper cutter", - "Paper towel", - "Parrot", - "Pastry", - "Peach", - "Pear", - "Pen", - "Pencil case", - "Penguin", - "Person", - "Piano", - "Picture frame", - "Pig", - "Pillow", - "Pitcher (Container)", - "Pizza", - "Pizza cutter", - "Plastic bag", - "Platter", - "Polar bear", - "Pomegranate", - "Popcorn", - "Potato", - "Power plugs and sockets", - "Pressure cooker", - "Pretzel", - "Printer", - "Pumpkin", - "Punching bag", - "Rabbit", - "Raccoon", - "Racket", - "Radish", - "Raven", - "Red panda", - "Remote control", - "Reptile", - "Rhinoceros", - "Rocket", - "Roller skates", - "Rose", - "Rugby ball", - "Ruler", - "Sandwich", - "Saucer", - "Saxophone", - "Scarf", - "Scissors", - "Screwdriver", - "Sculpture", - "Sea lion", - "Sea turtle", - "Seat belt", - "Segway", - "Shark", - "Sheep", - "Shirt", - "Shorts", - "Shower", - "Skateboard", - "Skirt", - "Skull", - "Skunk", - "Skyscraper", - "Slow cooker", - "Snake", - "Snowmobile", - "Soap dispenser", - "Sock", - "Sofa bed", - "Sombrero", - "Sparrow", - "Spatula", - "Spoon", - "Squash (Plant)", - "Squirrel", - "Stapler", - "Starfish", - "Stop sign", - "Strawberry", - "Studio couch", - "Submarine sandwich", - "Suit", - "Suitcase", - "Sun hat", - "Surfboard", - "Swan", - "Swim cap", - "Swimwear", - "Sword", - "Table tennis racket", - "Tablet computer", - "Tank", - "Tap", - "Tart", - "Taxi", - "Tea", - "Teapot", - "Teddy bear", - "Tennis ball", - "Tennis racket", - "Tie", - "Tiger", - "Toaster", - "Toilet", - "Toilet paper", - "Tomato", - "Torch", - "Tortoise", - "Towel", - "Toy", - "Traffic light", - "Traffic sign", - "Train", - "Trousers", - "Truck", - "Turkey", - "Turtle", - "Van", - "Vase", - "Vehicle registration plate", - "Volleyball (Ball)", - "Waffle", - "Washing machine", - "Waste container", - "Watch", - "Watermelon", - "Whale", - "Wheel", - "Whiteboard", - "Wine", - "Winter melon", - "Wok", - "Woman", - "Woodpecker", - "Wrench", - "Zebra", - "Zucchini", -] diff --git a/atman-open-images-eval/multimodal_explain_eval/data_prep.py b/atman-open-images-eval/multimodal_explain_eval/data_prep.py deleted file mode 100755 index 86a2750..0000000 --- a/atman-open-images-eval/multimodal_explain_eval/data_prep.py +++ /dev/null @@ -1,162 +0,0 @@ -from .dataset import SegmentationDataset -import os -from tqdm import tqdm -import numpy as np -import cv2 -import shutil - -from .utils import check_if_a_or_an_and_get_prefix - -def get_filenames_in_a_folder(folder: str): - """ - returns the list of paths to all the files in a given folder - """ - - files = os.listdir(folder) - num_files = len(files) - """ - - class A - - images - - 1.jpg - - 2.jpg - - masks - - 1.jpg - - 2.jpg - - - class B - - images - - 1.jpg - - 2.jpg - - masks - - 1.jpg - - 2.jpg - """ - - filenames_sorted = [ - f"{folder}/{x+1}.jpg" for x in range(num_files) - ] - return filenames_sorted - -def prepare_openimages_dataset( - segmentation_dataset: SegmentationDataset, - class_names: list, - output_folder = './openimages_cleaned', - num_samples_per_class = 100, - start_clean = False, - max_width_by_height = 1.2, - min_width_by_height = 0.8, - min_dim = 200 -): - - if os.path.exists(output_folder): - print(f'folder: {output_folder} already exists with folders:\n {get_filenames_in_a_folder(output_folder)}') - if start_clean is True: - print('starting clean, deleting existing folder...') - shutil.rmtree(output_folder) - os.mkdir(output_folder) - else: - print(f'making folder: {output_folder}') - os.mkdir(output_folder) - - metadata = {} - - for name in class_names: - metadata[name] = { - 'count': 0, - 'prefix': check_if_a_or_an_and_get_prefix(word = name), - 'folder': { - 'images': None, - 'masks': None - } - } - - """ - output_folder/ - dog/ - images/ - 1.jpg - 2.jpg - masks/ - 1.jpg - 2.jpg - cat/ - images/ - 1.jpg - 2.jpg - masks/ - 1.jpg - 2.jpg - """ - - for item in tqdm(segmentation_dataset.dataset, desc = 'preparing data:'): - stuff = segmentation_dataset.postprocess(item) - label = stuff['label'] - - if label in list(metadata.keys()): - - label_dir = output_folder + '/' + label - image_dir = label_dir + '/images' - mask_dir = label_dir + '/masks' - - if os.path.exists(label_dir) is False: - print(f'making folder: {label_dir}') - os.mkdir(label_dir) - - if os.path.exists(image_dir) is False: - print(f'making folder: {image_dir}') - os.mkdir(image_dir) - - if os.path.exists(mask_dir) is False: - print(f'making folder: {mask_dir}') - os.mkdir(mask_dir) - - ## I know this is redundant, but we'll run it only ones, so this worrks :) - metadata[label]['folder']['images'] = image_dir - metadata[label]['folder']['masks'] = mask_dir - - if metadata[label]['count'] >= num_samples_per_class: - continue - - image = stuff['image'] - mask = stuff['mask'] - - width, height = stuff['width'], stuff['height'] - - ratio = width/height - - minimum_dim_on_image = min([width, height]) - - if min_width_by_height < ratio < max_width_by_height and minimum_dim_on_image >= min_dim: - metadata[label]['count'] = metadata[label]['count'] + 1 - image_path = image_dir + f"/{metadata[label]['count']}.jpg" - mask_path = mask_dir + f"/{metadata[label]['count']}.jpg" - # print(f'filename {item.filepath}, label dir: {label_dir}, image_path: {image_path}') - - if os.path.exists(image_path) is False: - image.save(image_path) - # print(f'saving: {image_path}') - else: - print(f'already exists: {image_path}') - cv2.imwrite(mask_path, (mask*255).astype(np.uint8)) - else: - # print(f'rejecting: {label} because bad ratio: {ratio} or shape lower than min dim: {width, height}') - continue - - for label, data in metadata.items(): - - try: - assert data['count'] == num_samples_per_class, f"Expected {num_samples_per_class} samples for {label} but got {data['count']}" - except AssertionError: - print('WARNING:', f"Expected {num_samples_per_class} samples for {label} but got {data['count']}") - - try: - assert len(get_filenames_in_a_folder(data['folder']['images'])) == num_samples_per_class, f"Got {len(get_filenames_in_a_folder(data['folder']['images']))} images but expected {num_samples_per_class} images in folder: {get_filenames_in_a_folder(data['folder']['images'])}" - except AssertionError: - print('WARNING:', f"Got {len(get_filenames_in_a_folder(data['folder']['images']))} images but expected {num_samples_per_class} images in folder") - - try: - assert len(get_filenames_in_a_folder(data['folder']['masks'])) == num_samples_per_class, f"Got {len(get_filenames_in_a_folder(data['folder']['masks']))} masks but expected {num_samples_per_class} masks in folder: {get_filenames_in_a_folder(data['folder']['masks'])}" - except AssertionError: - print('WARNING:', f"Got {len(get_filenames_in_a_folder(data['folder']['masks']))} masks but expected {num_samples_per_class} masks in folder") - - return metadata \ No newline at end of file diff --git a/atman-open-images-eval/multimodal_explain_eval/dataloader.py b/atman-open-images-eval/multimodal_explain_eval/dataloader.py deleted file mode 100755 index a10d740..0000000 --- a/atman-open-images-eval/multimodal_explain_eval/dataloader.py +++ /dev/null @@ -1,109 +0,0 @@ -from PIL import Image -import cv2 -from .data_prep import get_filenames_in_a_folder -import os - -def center_crop_image(img, dim): - """Returns center cropped image - Args: - img: image to be center cropped - dim: dimensions (width, height) to be cropped - - source: https://gist.github.com/Nannigalaxy/35dd1d0722f29672e68b700bc5d44767 - """ - width, height = img.shape[1], img.shape[0] - - # process crop width and height for max available dimension - crop_width = dim[0] if dim[0] "importance" for the API - except KeyError: - dict_values.append(result["result"][idx]["explanation"][:144]) - values.append( - np.array([x["value"] for x in dict_values[-1]]).reshape(12, 12) - ) - - for v in values: - v[0, 0] = v.mean() - v[-1, -1] = v.mean() - - ## interpolation = cv2.INTER_NEAREST - - values = sum(values) / len(values) - - if width is not None and height is not None: - values = cv2.resize(values, (width, height), interpolation=cv2.INTER_NEAREST) - return values - - -def visualize_result( - prompt_image_pil, - prompt, - target, - result, - target_token_idx, - suppression_factor, - conceptual_suppression_threshold, - fontsize=20, - colormap=cv2.COLORMAP_VIRIDIS, - sigma=None, -): - dict_values = [] - values = [] - for idx in target_token_idx: - dict_values.append(result["result"][idx]["explanations"][:144]) - values.append( - np.array([x["importance"] for x in dict_values[-1]]).reshape(12, 12) - ) - - for v in values: - v[0, 0] = v.mean() - v[-1, -1] = v.mean() - - ## interpolation = cv2.INTER_NEAREST - values = cv2.resize( - sum(values) / len(values), (384, 384), interpolation=cv2.INTER_NEAREST - ).reshape(384, 384, 1) - - if sigma is not None: - values = values**sigma - - out = get_superimposed_heatmap( - image=cv2.resize( - np.array(prompt_image_pil), - dsize=(384, 384), - ), - heatmap=(normalize(values) * 255).astype(np.uint8), - colormap=colormap, - ) - - input_image = cv2.resize( - np.array(prompt_image_pil), - dsize=(384, 384), - ) - - fig, ax = plt.subplots(nrows=1, ncols=4, figsize=(30, 9)) - fig.suptitle(f"PROMPT: {prompt[-1]}\ntarget: {target}", fontsize=fontsize) - - ax[0].set_title("input image") - ax[0].imshow(input_image) - - ax[1].set_title( - f"target token: {''.join([result['result'][idx]['target_token_str'] for idx in target_token_idx])} \nsuppression_factor: {suppression_factor}\nconceptual_suppression_threshold: {conceptual_suppression_threshold}", - fontsize=fontsize, - ) - ax[1].imshow(out) - - im = ax[2].imshow(values) - ax[2].set_title(f"relative importance", fontsize=fontsize) - - im = ax[3].imshow(values, vmin=0, vmax=1) - ax[3].set_title( - f"non normalized\n max:{round(values.max(), 5)}\n min:{round(values.min(), 5)}", - fontsize=fontsize, - ) - - fig.colorbar(im, ax=ax) - - return input_image, values, out - - -import base64 -from io import BytesIO - - -def image_to_base64(image): - buffered = BytesIO() - image.save(buffered, format="JPEG") - buffer = buffered.getvalue() - return buffer - - -def decode(jpg_as_text): - pil_image = Image.open(BytesIO(base64.b64decode(jpg_as_text))) - return pil_image - - -def dict_to_json(dictionary, filename): - with open(filename, "w") as fp: - json.dump(dictionary, fp, indent=4) - - -def calculate_time( - num_classes, - num_images_per_class, - num_conceptual_suppression_thresholds, - num_seconds_per_sample, -): - - t = round(( - num_classes*num_images_per_class*num_conceptual_suppression_thresholds*num_seconds_per_sample - )/3600, 4) - - print( - f'''\nnum_classes: {num_classes} -num_images_per_class: {num_images_per_class} -num_conceptual_suppression_thresholds: {num_conceptual_suppression_thresholds} -num_seconds_per_sample: {num_seconds_per_sample} - -time estimate: {t} hours ----------------------------------------------------------------\n -''' - ) - return t - - -from typing import Callable - -def parse_results_for_single_image( - folder: str, - class_name: str, - idx: int, - dataloader, - metric_fn: Callable, - minimum_image_size: int = 384, - min_w_by_h: float = 0.9, - max_w_by_h: float = 1.1, - threshold: float = 0.1, - resize_to_12: bool = True, - result_dict: dict = None -): - ''' - result_dict looks like this: - SCORES_FOR_EACH_FILENAME = { - 'image_filename': [], - 'mask_filename': [], - 'explanation_filename': [], - 'precision_score': [], - 'label': [], - } - ''' - classes = list(dataloader.metadata.keys()) - - data = dataloader.fetch(classes.index(class_name), idx, center_crop=True, load_image = False) - y = data["mask"] - y = cv2.cvtColor(y, cv2.COLOR_BGR2GRAY) - y = y / y.max() - - ( - w, - h, - ) = y.shape - - min_dim = min([w, h]) - - ratio = w / h - - ## should have nice aspect ratio and big size, only then do we calculate precision score, else we return None - if min_dim > minimum_image_size and min_w_by_h < ratio < max_w_by_h: - - ## its idx + 1 because the filenames were 1 indexed - explanation_path = folder + "/" + class_name + f"/{idx+1}.jpg" - x = cv2.imread(explanation_path) - x = cv2.cvtColor(x, cv2.COLOR_BGR2GRAY) - x = cv2.resize(x, dsize=(w, h)) - x = x / (x.max() + 1e-8) - - if threshold is not None: - x[x < threshold] = 0.0 - - ## resize to 12x12 grids - if resize_to_12 is True: - x = cv2.resize(x, (12, 12)) - y = cv2.resize(y, (12, 12)) - score = metric_fn(x, y) - - if result_dict is not None: - ## keeping scores for each image file - result_dict['image_filename'].append( - data['image_path'] - ) - result_dict['mask_filename'].append( - data['mask_path'] - ) - result_dict['explanation_filename'].append( - explanation_path - ) - result_dict['precision_score'].append( - score - ) - - result_dict['label'].append( - class_name - ) - - return score - else: - return None - -from tqdm import tqdm -import os -import pandas as pd - -def calculate_eval_scores_from_result_folder( - folder, - output_csv_file, - dataloader, - metric_fn, - minimum_image_size = 384, - min_w_by_h = 0.1, - max_w_by_h = 1.5, - threshold = 0.1, - resize_to_12 = True, -): - - result_dict = { - 'image_filename': [], - 'mask_filename': [], - 'explanation_filename': [], - 'precision_score': [], - 'label': [], - } - - - for class_name in tqdm(list(dataloader.metadata.keys())): - num_images = dataloader.metadata[class_name]['count'] - for idx in tqdm(range(num_images), desc = f'{class_name}', disable = True): - # calculate score - try: - ## making sure the explanation filename exists :) - filename = folder + "/" + class_name + f"/{idx+1}.jpg" - assert os.path.exists(filename), f'Image {filename} does not exist' - - score = parse_results_for_single_image( - result_dict = result_dict, - folder = folder, - class_name = class_name, - idx = idx, - dataloader =dataloader, - metric_fn = metric_fn, - minimum_image_size = minimum_image_size, - min_w_by_h = min_w_by_h, - max_w_by_h = max_w_by_h, - threshold = threshold, - resize_to_12 = resize_to_12 - ) - except: - print(f'An error occured for class_name: {class_name} idx: {idx}') - - df = pd.DataFrame(result_dict) - df.to_csv(output_csv_file) - print(f'saved: {output_csv_file}') - - return df \ No newline at end of file diff --git a/atman-open-images-eval/prep_data.py b/atman-open-images-eval/prep_data.py deleted file mode 100755 index ef06d23..0000000 --- a/atman-open-images-eval/prep_data.py +++ /dev/null @@ -1,71 +0,0 @@ -from pprint import pprint - -from multimodal_explain_eval.data_prep import prepare_openimages_dataset -from multimodal_explain_eval.dataset import SegmentationDataset - -from multimodal_explain_eval.classes import openimages_v6_segmentation_classes -from pprint import pprint -import json - -# CLASSES = [ -# 'Car', -# 'Bus', -# 'Cat', -# 'Dog', -# 'Pizza', -# 'Hamburger', -# 'Tiger', -# 'Tortoise', -# 'Chicken', -# 'Calculator', -# 'Clock', -# 'Toilet', -# 'Zebra' -# ] - -CLASSES = openimages_v6_segmentation_classes - - -print(f'Preparing: {len(CLASSES)} classes') - -ORIGINAL_DATASET_DIR = '/open-images-atman-eval' -CLEAN_DATASET_DIR = '/openimages-cleaned-all-classes' - -all_metadata = {} - -for class_name in CLASSES: - - dataset = SegmentationDataset( - classes = [class_name], - dataset_dir = ORIGINAL_DATASET_DIR, - num_total_samples = 1000, # change to a large number before final run - width = None, - height = None, - split = 'train', ## change to train before final run - dataset_name = f'open-images-animals-{class_name}' - ) - - metadata = prepare_openimages_dataset( - segmentation_dataset = dataset, - class_names = [class_name], - output_folder = CLEAN_DATASET_DIR, - num_samples_per_class = 200, - start_clean = False, - max_width_by_height = 1.2, - min_width_by_height = 0.8, - min_dim = 200 - ) - key = list(metadata.keys())[0] - all_metadata[key] = metadata[key] - -pprint(all_metadata) - -with open('metadata.json', 'w') as fp: - json.dump(all_metadata, fp, indent = 4) - -count = 0 - -for key in all_metadata: - count += all_metadata[key]['count'] - -print(f'Saved a total of: {count} images in {CLEAN_DATASET_DIR}') diff --git a/atman-open-images-eval/requirements.in b/atman-open-images-eval/requirements.in deleted file mode 100755 index 71c96ec..0000000 --- a/atman-open-images-eval/requirements.in +++ /dev/null @@ -1,6 +0,0 @@ -pip-tools -aleph-alpha-client -datasets -opencv-python-headless -pillow -fiftyone \ No newline at end of file diff --git a/atman-open-images-eval/requirements.txt b/atman-open-images-eval/requirements.txt deleted file mode 100755 index af9f2bb..0000000 --- a/atman-open-images-eval/requirements.txt +++ /dev/null @@ -1,350 +0,0 @@ -# -# This file is autogenerated by pip-compile with python 3.9 -# To update, run: -# -# pip-compile requirements.in -# -aiofiles==0.8.0 - # via fiftyone -aiohttp==3.8.1 - # via - # datasets - # fsspec -aiosignal==1.2.0 - # via aiohttp -aleph-alpha-client==1.5.0 - # via -r requirements.in -anyio==3.6.1 - # via - # httpcore - # starlette -argcomplete==2.0.0 - # via - # fiftyone - # voxel51-eta -async-timeout==4.0.2 - # via aiohttp -attrs==21.4.0 - # via aiohttp -backports-cached-property==1.0.2 - # via strawberry-graphql -boto3==1.24.21 - # via fiftyone -botocore==1.27.21 - # via - # boto3 - # s3transfer -certifi==2022.6.15 - # via - # httpcore - # httpx - # requests -charset-normalizer==2.0.12 - # via - # aiohttp - # requests -click==8.1.3 - # via - # pip-tools - # strawberry-graphql -cycler==0.11.0 - # via matplotlib -dacite==1.6.0 - # via fiftyone -datasets==2.3.2 - # via -r requirements.in -deprecated==1.2.13 - # via fiftyone -dill==0.3.5.1 - # via - # datasets - # multiprocess - # voxel51-eta -dnspython==2.2.1 - # via eventlet -eventlet==0.33.1 - # via fiftyone -fiftyone==0.16.5 - # via -r requirements.in -fiftyone-brain==0.8.2 - # via fiftyone -fiftyone-db==0.3.0 - # via fiftyone -filelock==3.7.1 - # via huggingface-hub -fonttools==4.33.3 - # via matplotlib -frozenlist==1.3.0 - # via - # aiohttp - # aiosignal -fsspec[http]==2022.5.0 - # via datasets -future==0.18.2 - # via - # fiftyone - # voxel51-eta -glob2==0.7 - # via voxel51-eta -graphql-core==3.1.7 - # via strawberry-graphql -greenlet==1.1.2 - # via eventlet -h11==0.12.0 - # via - # httpcore - # hypercorn - # wsproto -h2==4.1.0 - # via hypercorn -hpack==4.0.0 - # via h2 -httpcore==0.15.0 - # via httpx -httpx==0.23.0 - # via universal-analytics-python3 -huggingface-hub==0.8.1 - # via datasets -hypercorn==0.13.2 - # via fiftyone -hyperframe==6.0.1 - # via h2 -idna==3.3 - # via - # anyio - # requests - # rfc3986 - # yarl -imageio==2.19.3 - # via scikit-image -jinja2==3.1.2 - # via fiftyone -jmespath==1.0.1 - # via - # boto3 - # botocore -joblib==1.1.0 - # via scikit-learn -kaleido==0.2.1 - # via fiftyone -kiwisolver==1.4.3 - # via matplotlib -markupsafe==2.1.1 - # via jinja2 -matplotlib==3.5.2 - # via fiftyone -mongoengine==0.20.0 - # via fiftyone -motor==2.5.1 - # via fiftyone -multidict==6.0.2 - # via - # aiohttp - # yarl -multiprocess==0.70.13 - # via datasets -ndjson==0.3.1 - # via - # fiftyone - # voxel51-eta -networkx==2.8.4 - # via scikit-image -numpy==1.22.4 - # via - # datasets - # fiftyone - # fiftyone-brain - # imageio - # matplotlib - # opencv-python-headless - # pandas - # pyarrow - # pywavelets - # scikit-image - # scikit-learn - # scipy - # tifffile - # voxel51-eta -opencv-python-headless==4.6.0.66 - # via - # -r requirements.in - # fiftyone - # voxel51-eta -packaging==21.3 - # via - # datasets - # fiftyone - # huggingface-hub - # matplotlib - # scikit-image - # voxel51-eta -pandas==1.4.2 - # via - # datasets - # fiftyone -patool==1.12 - # via voxel51-eta -pep517==0.12.0 - # via pip-tools -pillow==9.1.1 - # via - # -r requirements.in - # fiftyone - # imageio - # matplotlib - # scikit-image - # voxel51-eta -pip-tools==6.6.2 - # via -r requirements.in -plotly==4.14.3 - # via fiftyone -pprintpp==0.4.0 - # via fiftyone -priority==2.0.0 - # via hypercorn -psutil==5.9.1 - # via fiftyone -pyarrow==8.0.0 - # via datasets -pygments==2.12.0 - # via strawberry-graphql -pymongo==3.12.3 - # via - # fiftyone - # mongoengine - # motor -pyparsing==3.0.9 - # via - # matplotlib - # packaging -python-dateutil==2.8.2 - # via - # botocore - # matplotlib - # pandas - # strawberry-graphql - # voxel51-eta -python-multipart==0.0.5 - # via strawberry-graphql -pytz==2022.1 - # via - # fiftyone - # pandas - # voxel51-eta -pytz-deprecation-shim==0.1.0.post0 - # via tzlocal -pywavelets==1.3.0 - # via scikit-image -pyyaml==6.0 - # via - # fiftyone - # huggingface-hub -requests==2.28.0 - # via - # aleph-alpha-client - # datasets - # fsspec - # huggingface-hub - # responses - # voxel51-eta -responses==0.18.0 - # via datasets -retrying==1.3.3 - # via - # fiftyone - # plotly - # voxel51-eta -rfc3986[idna2008]==1.5.0 - # via httpx -s3transfer==0.6.0 - # via boto3 -scikit-image==0.19.3 - # via - # fiftyone - # voxel51-eta -scikit-learn==1.1.1 - # via - # fiftyone - # fiftyone-brain -scipy==1.8.1 - # via - # fiftyone-brain - # scikit-image - # scikit-learn -sentinel==0.3.0 - # via strawberry-graphql -six==1.16.0 - # via - # eventlet - # plotly - # python-dateutil - # python-multipart - # retrying - # voxel51-eta -sniffio==1.2.0 - # via - # anyio - # httpcore - # httpx -sortedcontainers==2.4.0 - # via voxel51-eta -sse-starlette==0.10.3 - # via fiftyone -sseclient-py==1.7.2 - # via fiftyone -starlette==0.16.0 - # via - # fiftyone - # sse-starlette -strawberry-graphql==0.96.0 - # via fiftyone -tabulate==0.8.10 - # via - # fiftyone - # voxel51-eta -threadpoolctl==3.1.0 - # via scikit-learn -tifffile==2022.5.4 - # via scikit-image -toml==0.10.2 - # via hypercorn -tomli==2.0.1 - # via pep517 -tqdm==4.64.0 - # via - # datasets - # huggingface-hub -typing-extensions==4.2.0 - # via - # huggingface-hub - # strawberry-graphql -tzdata==2022.1 - # via pytz-deprecation-shim -tzlocal==4.2 - # via voxel51-eta -universal-analytics-python3==1.1.1 - # via fiftyone -urllib3==1.26.9 - # via - # botocore - # requests - # responses - # voxel51-eta -voxel51-eta==0.7.1 - # via fiftyone -wheel==0.37.1 - # via pip-tools -wrapt==1.14.1 - # via deprecated -wsproto==1.1.0 - # via hypercorn -xmltodict==0.13.0 - # via fiftyone -xxhash==3.0.0 - # via datasets -yarl==1.7.2 - # via aiohttp - -# The following packages are considered to be unsafe in a requirements file: -# pip -# setuptools diff --git a/atman-open-images-eval/run.py b/atman-open-images-eval/run.py deleted file mode 100755 index 8a91694..0000000 --- a/atman-open-images-eval/run.py +++ /dev/null @@ -1,100 +0,0 @@ -from multimodal_explain_eval.eval import run_eval -from multimodal_explain_eval.dataloader import DataLoader -from multimodal_explain_eval.utils import load_json_as_dict - -import os -import yaml -import logging -from generator import Generator - -with open("config.yml", "r") as stream: - config = yaml.safe_load(stream) - -logger = logging.getLogger() -handler = logging.FileHandler(config['logfile']) -logger.addHandler(handler) -logger = logging.getLogger() -logger.info(f"Running with config: {config}") - - -conc_sup_values = config["hyperparams"]["conc_sup_values"] -suppression_factor_values = config["hyperparams"]["suppression_factor_values"] -RESULT_DIR = config["files"]["result_dir"] -JSON_DIR = config["files"]["raw_jsons_folder"] -metadata = load_json_as_dict(config["files"]["metadata_filename"]) - -num_images = 0 - -for key in metadata: - num_images += metadata[key]["count"] - # print(f"{key:<17}:", metadata[key]["count"]) - -print(f"total {num_images} pairs across {len(metadata)} classes") - -num_total_explanations = ( - len(conc_sup_values) * len(suppression_factor_values) * num_images -) -print(f"Will run a total of: {num_total_explanations} explanations") - -folder_names = [] -json_folder_names = [] -assert os.path.exists(RESULT_DIR) == True, f"Expected folder to exist:{RESULT_DIR}" - -for x in conc_sup_values: - for y in suppression_factor_values: - folder_names.append( - f"{RESULT_DIR}/con_sup_thres_{round(x, 2) if x is not None else None}_suppression_factor_{round(y, 2) if x is not None else None}" - ) - json_folder_names.append( - f"{JSON_DIR}/con_sup_thres_{round(x, 2) if x is not None else None}_suppression_factor_{round(y, 2) if x is not None else None}" - ) - -print('FOLDER NAMES:') -for f in folder_names: - print(f) - -print('-'*100) -print('JSON FOLDER NAMES') -for f in json_folder_names: - print(f) - -print("preparing dataloader...") -dataloader = DataLoader(metadata=metadata) - -print("loading generator") -generator_context = Generator.from_checkpoint( - tokenizer_file=config["generator"]["tokenizer_file"], - checkpoint_dir=config["generator"]["checkpoint_dir"], - pipe_parallel_size=config["generator"]["pipe_parallel_size"], -) - -folder_idx = 0 - -print("STARTED RUN, GO TO SLEEP zzz") - -with generator_context as generator: - for conceptual_suppression_threshold in conc_sup_values: - for suppression_factor in suppression_factor_values: - - folder_name = folder_names[folder_idx] - result_metadata = run_eval( - generator=generator, - result_folder=folder_name, - logger = logger, - text_prompt=config["hyperparams"]["prompt_text"], - max_batch_size=config["generator"]["max_batch_size"], - suppression_factor=suppression_factor, - conceptual_suppression_threshold=conceptual_suppression_threshold, - dataloader=dataloader, - metadata=metadata, - use_lowercase_target=True, - auto_decide_a_or_an=True, - progress=True, - raw_jsons_folder=json_folder_names[folder_idx], - normalize=config["generator"]["normalize"], - square_outputs=config["generator"]["square_outputs"], - num_total_explanations=num_total_explanations - ) - folder_idx += 1 - -print("RUN COMPLETE, hope you slept well :)") diff --git a/atman-open-images-eval/setup.py b/atman-open-images-eval/setup.py deleted file mode 100755 index 2efa87b..0000000 --- a/atman-open-images-eval/setup.py +++ /dev/null @@ -1,31 +0,0 @@ -import setuptools - -with open("README.md", "r") as fh: - long_description = fh.read() - -with open('requirements.txt') as f: - required = f.read().splitlines() - -setuptools.setup( - name="atman-open-images-eval", - version="0.0.1", - author="Aleph-Alpha", - author_email="", - description= "open images dataset eval code for explainability benchmark", - long_description=long_description, - long_description_content_type="text/markdown", - url="", - packages=setuptools.find_packages(), - install_requires= required, - python_requires='>=3.6', - include_package_data=True, - keywords=[ - "PyTorch", - "machine learning", - ], - classifiers=[ - "Intended Audience :: Science/Research", - ], - test_suite='nose.collector', - tests_require=['nose'] -) diff --git a/atman-open-images-eval/setup.sh b/atman-open-images-eval/setup.sh deleted file mode 100755 index 10d1224..0000000 --- a/atman-open-images-eval/setup.sh +++ /dev/null @@ -1,5 +0,0 @@ -pip install -r requirements.txt -pip install "opencv-python-headless<4.3" -pip install gdown -## download dataset: https://drive.google.com/file/d/1w-IWWnW8DzRrudZtojPibBP-LYvG4zxU/view?usp=sharing -gdown 1w-IWWnW8DzRrudZtojPibBP-LYvG4zxU diff --git a/determined/determined_eval_wrapper.py b/determined/determined_eval_wrapper.py deleted file mode 100755 index 4364d82..0000000 --- a/determined/determined_eval_wrapper.py +++ /dev/null @@ -1,32 +0,0 @@ -from dataclasses import dataclass, fields - - -@dataclass -class EvalParams: - sup_fact: str = ".3" - conc_sup: str = ".3" - result_path: str = "/det_cos_nolog_mult" - layers: str=None - - -def process_determined_hparams(hparams): - """ - Process the 'hyperparameters:' block in the determined config. Returns a custom dataclass with the specified parameter values. Hyperparameters are optional; if provided they override the command-line args in the 'entrypoint' command; if not provided, they can also be set in 'entrypoint:' if common for all tasks/models or the default values in main.py are used. - """ - - param_mismatches = [] - - fieldSet = { - f.name if f.init else param_mismatches.append(f.name) - for f in fields(EvalParams) - } - if param_mismatches != []: - raise KeyError( - f"The Parameters: {param_mismatches} are not included in the Dataclass." - ) - - filteredArgDict = {k: v for k, v in hparams.items() if k in fieldSet} - print("Filtered Arg Dict", filteredArgDict) - merged_params = EvalParams(**filteredArgDict) - - return merged_params diff --git a/determined/metadata.json b/determined/metadata.json deleted file mode 100755 index 5c37129..0000000 --- a/determined/metadata.json +++ /dev/null @@ -1,2802 +0,0 @@ -{ - "Adhesive tape": { - "count": 0, - "prefix": "an", - "folder": { - "images": "/openimages-mini/Adhesive tape/images", - "masks": "/openimages-mini/Adhesive tape/masks" - } - }, - "Aircraft": { - "count": 0, - "prefix": "an", - "folder": { - "images": "/openimages-mini/Aircraft/images", - "masks": "/openimages-mini/Aircraft/masks" - } - }, - "Airplane": { - "count": 0, - "prefix": "an", - "folder": { - "images": "/openimages-mini/Airplane/images", - "masks": "/openimages-mini/Airplane/masks" - } - }, - "Alarm clock": { - "count": 1, - "prefix": "an", - "folder": { - "images": "/openimages-mini/Alarm clock/images", - "masks": "/openimages-mini/Alarm clock/masks" - } - }, - "Alpaca": { - "count": 1, - "prefix": "an", - "folder": { - "images": "/openimages-mini/Alpaca/images", - "masks": "/openimages-mini/Alpaca/masks" - } - }, - "Ambulance": { - "count": 0, - "prefix": "an", - "folder": { - "images": "/openimages-mini/Ambulance/images", - "masks": "/openimages-mini/Ambulance/masks" - } - }, - "Apple": { - "count": 1, - "prefix": "an", - "folder": { - "images": "/openimages-mini/Apple/images", - "masks": "/openimages-mini/Apple/masks" - } - }, - "Armadillo": { - "count": 0, - "prefix": "an", - "folder": { - "images": null, - "masks": null - } - }, - "Artichoke": { - "count": 1, - "prefix": "an", - "folder": { - "images": "/openimages-mini/Artichoke/images", - "masks": "/openimages-mini/Artichoke/masks" - } - }, - "Axe": { - "count": 0, - "prefix": "an", - "folder": { - "images": null, - "masks": null - } - }, - "Backpack": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Backpack/images", - "masks": "/openimages-mini/Backpack/masks" - } - }, - "Bagel": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Bagel/images", - "masks": "/openimages-mini/Bagel/masks" - } - }, - "Balance beam": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Balance beam/images", - "masks": "/openimages-mini/Balance beam/masks" - } - }, - "Ball": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Ball/images", - "masks": "/openimages-mini/Ball/masks" - } - }, - "Balloon": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Balloon/images", - "masks": "/openimages-mini/Balloon/masks" - } - }, - "Banana": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Banana/images", - "masks": "/openimages-mini/Banana/masks" - } - }, - "Band-aid": { - "count": 0, - "prefix": "a", - "folder": { - "images": null, - "masks": null - } - }, - "Barge": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Barge/images", - "masks": "/openimages-mini/Barge/masks" - } - }, - "Barrel": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Barrel/images", - "masks": "/openimages-mini/Barrel/masks" - } - }, - "Baseball bat": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Baseball bat/images", - "masks": "/openimages-mini/Baseball bat/masks" - } - }, - "Baseball glove": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Baseball glove/images", - "masks": "/openimages-mini/Baseball glove/masks" - } - }, - "Bat (Animal)": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Bat (Animal)/images", - "masks": "/openimages-mini/Bat (Animal)/masks" - } - }, - "Beaker": { - "count": 0, - "prefix": "a", - "folder": { - "images": null, - "masks": null - } - }, - "Bear": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Bear/images", - "masks": "/openimages-mini/Bear/masks" - } - }, - "Beer": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Beer/images", - "masks": "/openimages-mini/Beer/masks" - } - }, - "Bell pepper": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Bell pepper/images", - "masks": "/openimages-mini/Bell pepper/masks" - } - }, - "Belt": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Belt/images", - "masks": "/openimages-mini/Belt/masks" - } - }, - "Bicycle wheel": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Bicycle wheel/images", - "masks": "/openimages-mini/Bicycle wheel/masks" - } - }, - "Billiard table": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Billiard table/images", - "masks": "/openimages-mini/Billiard table/masks" - } - }, - "Binoculars": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Binoculars/images", - "masks": "/openimages-mini/Binoculars/masks" - } - }, - "Bird": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Bird/images", - "masks": "/openimages-mini/Bird/masks" - } - }, - "Blue jay": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Blue jay/images", - "masks": "/openimages-mini/Blue jay/masks" - } - }, - "Bomb": { - "count": 0, - "prefix": "a", - "folder": { - "images": null, - "masks": null - } - }, - "Book": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Book/images", - "masks": "/openimages-mini/Book/masks" - } - }, - "Boot": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Boot/images", - "masks": "/openimages-mini/Boot/masks" - } - }, - "Bottle": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Bottle/images", - "masks": "/openimages-mini/Bottle/masks" - } - }, - "Bottle opener": { - "count": 0, - "prefix": "a", - "folder": { - "images": null, - "masks": null - } - }, - "Bowl": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Bowl/images", - "masks": "/openimages-mini/Bowl/masks" - } - }, - "Box": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Box/images", - "masks": "/openimages-mini/Box/masks" - } - }, - "Boy": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Boy/images", - "masks": "/openimages-mini/Boy/masks" - } - }, - "Bread": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Bread/images", - "masks": "/openimages-mini/Bread/masks" - } - }, - "Briefcase": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Briefcase/images", - "masks": "/openimages-mini/Briefcase/masks" - } - }, - "Broccoli": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Broccoli/images", - "masks": "/openimages-mini/Broccoli/masks" - } - }, - "Bronze sculpture": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Bronze sculpture/images", - "masks": "/openimages-mini/Bronze sculpture/masks" - } - }, - "Brown bear": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Brown bear/images", - "masks": "/openimages-mini/Brown bear/masks" - } - }, - "Bull": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Bull/images", - "masks": "/openimages-mini/Bull/masks" - } - }, - "Burrito": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Burrito/images", - "masks": "/openimages-mini/Burrito/masks" - } - }, - "Bus": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Bus/images", - "masks": "/openimages-mini/Bus/masks" - } - }, - "Bust": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Bust/images", - "masks": "/openimages-mini/Bust/masks" - } - }, - "Cabbage": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Cabbage/images", - "masks": "/openimages-mini/Cabbage/masks" - } - }, - "Cake": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Cake/images", - "masks": "/openimages-mini/Cake/masks" - } - }, - "Calculator": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Calculator/images", - "masks": "/openimages-mini/Calculator/masks" - } - }, - "Camel": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Camel/images", - "masks": "/openimages-mini/Camel/masks" - } - }, - "Camera": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Camera/images", - "masks": "/openimages-mini/Camera/masks" - } - }, - "Canary": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Canary/images", - "masks": "/openimages-mini/Canary/masks" - } - }, - "Candle": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Candle/images", - "masks": "/openimages-mini/Candle/masks" - } - }, - "Canoe": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Canoe/images", - "masks": "/openimages-mini/Canoe/masks" - } - }, - "Cantaloupe": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Cantaloupe/images", - "masks": "/openimages-mini/Cantaloupe/masks" - } - }, - "Car": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Car/images", - "masks": "/openimages-mini/Car/masks" - } - }, - "Carnivore": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Carnivore/images", - "masks": "/openimages-mini/Carnivore/masks" - } - }, - "Carrot": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Carrot/images", - "masks": "/openimages-mini/Carrot/masks" - } - }, - "Cat": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Cat/images", - "masks": "/openimages-mini/Cat/masks" - } - }, - "Cattle": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Cattle/images", - "masks": "/openimages-mini/Cattle/masks" - } - }, - "Cello": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Cello/images", - "masks": "/openimages-mini/Cello/masks" - } - }, - "Cheese": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Cheese/images", - "masks": "/openimages-mini/Cheese/masks" - } - }, - "Cheetah": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Cheetah/images", - "masks": "/openimages-mini/Cheetah/masks" - } - }, - "Chest of drawers": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Chest of drawers/images", - "masks": "/openimages-mini/Chest of drawers/masks" - } - }, - "Chicken": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Chicken/images", - "masks": "/openimages-mini/Chicken/masks" - } - }, - "Chisel": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Chisel/images", - "masks": "/openimages-mini/Chisel/masks" - } - }, - "Chopsticks": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Chopsticks/images", - "masks": "/openimages-mini/Chopsticks/masks" - } - }, - "Christmas tree": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Christmas tree/images", - "masks": "/openimages-mini/Christmas tree/masks" - } - }, - "Clock": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Clock/images", - "masks": "/openimages-mini/Clock/masks" - } - }, - "Clothing": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Clothing/images", - "masks": "/openimages-mini/Clothing/masks" - } - }, - "Cocktail": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Cocktail/images", - "masks": "/openimages-mini/Cocktail/masks" - } - }, - "Cocktail shaker": { - "count": 0, - "prefix": "a", - "folder": { - "images": null, - "masks": null - } - }, - "Coffee": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Coffee/images", - "masks": "/openimages-mini/Coffee/masks" - } - }, - "Coffee cup": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Coffee cup/images", - "masks": "/openimages-mini/Coffee cup/masks" - } - }, - "Coin": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Coin/images", - "masks": "/openimages-mini/Coin/masks" - } - }, - "Common fig": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Common fig/images", - "masks": "/openimages-mini/Common fig/masks" - } - }, - "Common sunflower": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Common sunflower/images", - "masks": "/openimages-mini/Common sunflower/masks" - } - }, - "Computer keyboard": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Computer keyboard/images", - "masks": "/openimages-mini/Computer keyboard/masks" - } - }, - "Computer mouse": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Computer mouse/images", - "masks": "/openimages-mini/Computer mouse/masks" - } - }, - "Cookie": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Cookie/images", - "masks": "/openimages-mini/Cookie/masks" - } - }, - "Cooking spray": { - "count": 0, - "prefix": "a", - "folder": { - "images": null, - "masks": null - } - }, - "Corded phone": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Corded phone/images", - "masks": "/openimages-mini/Corded phone/masks" - } - }, - "Couch": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Couch/images", - "masks": "/openimages-mini/Couch/masks" - } - }, - "Cowboy hat": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Cowboy hat/images", - "masks": "/openimages-mini/Cowboy hat/masks" - } - }, - "Cricket ball": { - "count": 0, - "prefix": "a", - "folder": { - "images": null, - "masks": null - } - }, - "Crocodile": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Crocodile/images", - "masks": "/openimages-mini/Crocodile/masks" - } - }, - "Croissant": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Croissant/images", - "masks": "/openimages-mini/Croissant/masks" - } - }, - "Cucumber": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Cucumber/images", - "masks": "/openimages-mini/Cucumber/masks" - } - }, - "Dagger": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Dagger/images", - "masks": "/openimages-mini/Dagger/masks" - } - }, - "Diaper": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Diaper/images", - "masks": "/openimages-mini/Diaper/masks" - } - }, - "Dice": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Dice/images", - "masks": "/openimages-mini/Dice/masks" - } - }, - "Digital clock": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Digital clock/images", - "masks": "/openimages-mini/Digital clock/masks" - } - }, - "Dog": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Dog/images", - "masks": "/openimages-mini/Dog/masks" - } - }, - "Dog bed": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Dog bed/images", - "masks": "/openimages-mini/Dog bed/masks" - } - }, - "Dolphin": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Dolphin/images", - "masks": "/openimages-mini/Dolphin/masks" - } - }, - "Door handle": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Door handle/images", - "masks": "/openimages-mini/Door handle/masks" - } - }, - "Doughnut": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Doughnut/images", - "masks": "/openimages-mini/Doughnut/masks" - } - }, - "Dress": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Dress/images", - "masks": "/openimages-mini/Dress/masks" - } - }, - "Drill (Tool)": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Drill (Tool)/images", - "masks": "/openimages-mini/Drill (Tool)/masks" - } - }, - "Drink": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Drink/images", - "masks": "/openimages-mini/Drink/masks" - } - }, - "Drinking straw": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Drinking straw/images", - "masks": "/openimages-mini/Drinking straw/masks" - } - }, - "Duck": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Duck/images", - "masks": "/openimages-mini/Duck/masks" - } - }, - "Dumbbell": { - "count": 0, - "prefix": "a", - "folder": { - "images": null, - "masks": null - } - }, - "Eagle": { - "count": 1, - "prefix": "an", - "folder": { - "images": "/openimages-mini/Eagle/images", - "masks": "/openimages-mini/Eagle/masks" - } - }, - "Elephant": { - "count": 1, - "prefix": "an", - "folder": { - "images": "/openimages-mini/Elephant/images", - "masks": "/openimages-mini/Elephant/masks" - } - }, - "Envelope": { - "count": 1, - "prefix": "an", - "folder": { - "images": "/openimages-mini/Envelope/images", - "masks": "/openimages-mini/Envelope/masks" - } - }, - "Eraser": { - "count": 0, - "prefix": "an", - "folder": { - "images": null, - "masks": null - } - }, - "Facial tissue holder": { - "count": 0, - "prefix": "a", - "folder": { - "images": null, - "masks": null - } - }, - "Falcon": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Falcon/images", - "masks": "/openimages-mini/Falcon/masks" - } - }, - "Fedora": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Fedora/images", - "masks": "/openimages-mini/Fedora/masks" - } - }, - "Filing cabinet": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Filing cabinet/images", - "masks": "/openimages-mini/Filing cabinet/masks" - } - }, - "Fire hydrant": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Fire hydrant/images", - "masks": "/openimages-mini/Fire hydrant/masks" - } - }, - "Fish": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Fish/images", - "masks": "/openimages-mini/Fish/masks" - } - }, - "Flag": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Flag/images", - "masks": "/openimages-mini/Flag/masks" - } - }, - "Flashlight": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Flashlight/images", - "masks": "/openimages-mini/Flashlight/masks" - } - }, - "Flower": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Flower/images", - "masks": "/openimages-mini/Flower/masks" - } - }, - "Flowerpot": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Flowerpot/images", - "masks": "/openimages-mini/Flowerpot/masks" - } - }, - "Flute": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Flute/images", - "masks": "/openimages-mini/Flute/masks" - } - }, - "Flying disc": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Flying disc/images", - "masks": "/openimages-mini/Flying disc/masks" - } - }, - "Food processor": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Food processor/images", - "masks": "/openimages-mini/Food processor/masks" - } - }, - "Football": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Football/images", - "masks": "/openimages-mini/Football/masks" - } - }, - "Fox": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Fox/images", - "masks": "/openimages-mini/Fox/masks" - } - }, - "Frog": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Frog/images", - "masks": "/openimages-mini/Frog/masks" - } - }, - "Frying pan": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Frying pan/images", - "masks": "/openimages-mini/Frying pan/masks" - } - }, - "Garden Asparagus": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Garden Asparagus/images", - "masks": "/openimages-mini/Garden Asparagus/masks" - } - }, - "Giraffe": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Giraffe/images", - "masks": "/openimages-mini/Giraffe/masks" - } - }, - "Girl": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Girl/images", - "masks": "/openimages-mini/Girl/masks" - } - }, - "Glove": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Glove/images", - "masks": "/openimages-mini/Glove/masks" - } - }, - "Goat": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Goat/images", - "masks": "/openimages-mini/Goat/masks" - } - }, - "Goldfish": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Goldfish/images", - "masks": "/openimages-mini/Goldfish/masks" - } - }, - "Golf ball": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Golf ball/images", - "masks": "/openimages-mini/Golf ball/masks" - } - }, - "Goose": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Goose/images", - "masks": "/openimages-mini/Goose/masks" - } - }, - "Grape": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Grape/images", - "masks": "/openimages-mini/Grape/masks" - } - }, - "Grapefruit": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Grapefruit/images", - "masks": "/openimages-mini/Grapefruit/masks" - } - }, - "Guacamole": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Guacamole/images", - "masks": "/openimages-mini/Guacamole/masks" - } - }, - "Guitar": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Guitar/images", - "masks": "/openimages-mini/Guitar/masks" - } - }, - "Hair dryer": { - "count": 0, - "prefix": "a", - "folder": { - "images": null, - "masks": null - } - }, - "Hair spray": { - "count": 0, - "prefix": "a", - "folder": { - "images": null, - "masks": null - } - }, - "Hamburger": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Hamburger/images", - "masks": "/openimages-mini/Hamburger/masks" - } - }, - "Hammer": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Hammer/images", - "masks": "/openimages-mini/Hammer/masks" - } - }, - "Hamster": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Hamster/images", - "masks": "/openimages-mini/Hamster/masks" - } - }, - "Hand dryer": { - "count": 0, - "prefix": "a", - "folder": { - "images": null, - "masks": null - } - }, - "Handbag": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Handbag/images", - "masks": "/openimages-mini/Handbag/masks" - } - }, - "Handgun": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Handgun/images", - "masks": "/openimages-mini/Handgun/masks" - } - }, - "Harbor seal": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Harbor seal/images", - "masks": "/openimages-mini/Harbor seal/masks" - } - }, - "Harmonica": { - "count": 0, - "prefix": "a", - "folder": { - "images": null, - "masks": null - } - }, - "Harpsichord": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Harpsichord/images", - "masks": "/openimages-mini/Harpsichord/masks" - } - }, - "Hat": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Hat/images", - "masks": "/openimages-mini/Hat/masks" - } - }, - "Heater": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Heater/images", - "masks": "/openimages-mini/Heater/masks" - } - }, - "Hedgehog": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Hedgehog/images", - "masks": "/openimages-mini/Hedgehog/masks" - } - }, - "High heels": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/High heels/images", - "masks": "/openimages-mini/High heels/masks" - } - }, - "Hippopotamus": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Hippopotamus/images", - "masks": "/openimages-mini/Hippopotamus/masks" - } - }, - "Horse": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Horse/images", - "masks": "/openimages-mini/Horse/masks" - } - }, - "Hot dog": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Hot dog/images", - "masks": "/openimages-mini/Hot dog/masks" - } - }, - "Human body": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Human body/images", - "masks": "/openimages-mini/Human body/masks" - } - }, - "Human ear": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Human ear/images", - "masks": "/openimages-mini/Human ear/masks" - } - }, - "Human mouth": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Human mouth/images", - "masks": "/openimages-mini/Human mouth/masks" - } - }, - "Ipod": { - "count": 1, - "prefix": "an", - "folder": { - "images": "/openimages-mini/Ipod/images", - "masks": "/openimages-mini/Ipod/masks" - } - }, - "Jaguar (Animal)": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Jaguar (Animal)/images", - "masks": "/openimages-mini/Jaguar (Animal)/masks" - } - }, - "Jeans": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Jeans/images", - "masks": "/openimages-mini/Jeans/masks" - } - }, - "Jet ski": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Jet ski/images", - "masks": "/openimages-mini/Jet ski/masks" - } - }, - "Jug": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Jug/images", - "masks": "/openimages-mini/Jug/masks" - } - }, - "Juice": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Juice/images", - "masks": "/openimages-mini/Juice/masks" - } - }, - "Kangaroo": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Kangaroo/images", - "masks": "/openimages-mini/Kangaroo/masks" - } - }, - "Kettle": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Kettle/images", - "masks": "/openimages-mini/Kettle/masks" - } - }, - "Kitchen knife": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Kitchen knife/images", - "masks": "/openimages-mini/Kitchen knife/masks" - } - }, - "Kite": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Kite/images", - "masks": "/openimages-mini/Kite/masks" - } - }, - "Knife": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Knife/images", - "masks": "/openimages-mini/Knife/masks" - } - }, - "Koala": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Koala/images", - "masks": "/openimages-mini/Koala/masks" - } - }, - "Ladle": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Ladle/images", - "masks": "/openimages-mini/Ladle/masks" - } - }, - "Laptop": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Laptop/images", - "masks": "/openimages-mini/Laptop/masks" - } - }, - "Lemon": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Lemon/images", - "masks": "/openimages-mini/Lemon/masks" - } - }, - "Leopard": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Leopard/images", - "masks": "/openimages-mini/Leopard/masks" - } - }, - "Light switch": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Light switch/images", - "masks": "/openimages-mini/Light switch/masks" - } - }, - "Lighthouse": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Lighthouse/images", - "masks": "/openimages-mini/Lighthouse/masks" - } - }, - "Limousine": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Limousine/images", - "masks": "/openimages-mini/Limousine/masks" - } - }, - "Lion": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Lion/images", - "masks": "/openimages-mini/Lion/masks" - } - }, - "Lipstick": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Lipstick/images", - "masks": "/openimages-mini/Lipstick/masks" - } - }, - "Lizard": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Lizard/images", - "masks": "/openimages-mini/Lizard/masks" - } - }, - "Loveseat": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Loveseat/images", - "masks": "/openimages-mini/Loveseat/masks" - } - }, - "Luggage and bags": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Luggage and bags/images", - "masks": "/openimages-mini/Luggage and bags/masks" - } - }, - "Lynx": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Lynx/images", - "masks": "/openimages-mini/Lynx/masks" - } - }, - "Magpie": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Magpie/images", - "masks": "/openimages-mini/Magpie/masks" - } - }, - "Man": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Man/images", - "masks": "/openimages-mini/Man/masks" - } - }, - "Mango": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Mango/images", - "masks": "/openimages-mini/Mango/masks" - } - }, - "Maracas": { - "count": 0, - "prefix": "a", - "folder": { - "images": null, - "masks": null - } - }, - "Measuring cup": { - "count": 0, - "prefix": "a", - "folder": { - "images": null, - "masks": null - } - }, - "Microwave oven": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Microwave oven/images", - "masks": "/openimages-mini/Microwave oven/masks" - } - }, - "Milk": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Milk/images", - "masks": "/openimages-mini/Milk/masks" - } - }, - "Miniskirt": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Miniskirt/images", - "masks": "/openimages-mini/Miniskirt/masks" - } - }, - "Missile": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Missile/images", - "masks": "/openimages-mini/Missile/masks" - } - }, - "Mixing bowl": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Mixing bowl/images", - "masks": "/openimages-mini/Mixing bowl/masks" - } - }, - "Mobile phone": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Mobile phone/images", - "masks": "/openimages-mini/Mobile phone/masks" - } - }, - "Monkey": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Monkey/images", - "masks": "/openimages-mini/Monkey/masks" - } - }, - "Motorcycle": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Motorcycle/images", - "masks": "/openimages-mini/Motorcycle/masks" - } - }, - "Mouse": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Mouse/images", - "masks": "/openimages-mini/Mouse/masks" - } - }, - "Muffin": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Muffin/images", - "masks": "/openimages-mini/Muffin/masks" - } - }, - "Mug": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Mug/images", - "masks": "/openimages-mini/Mug/masks" - } - }, - "Mule": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Mule/images", - "masks": "/openimages-mini/Mule/masks" - } - }, - "Mushroom": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Mushroom/images", - "masks": "/openimages-mini/Mushroom/masks" - } - }, - "Nail (Construction)": { - "count": 0, - "prefix": "a", - "folder": { - "images": null, - "masks": null - } - }, - "Orange": { - "count": 1, - "prefix": "an", - "folder": { - "images": "/openimages-mini/Orange/images", - "masks": "/openimages-mini/Orange/masks" - } - }, - "Ostrich": { - "count": 1, - "prefix": "an", - "folder": { - "images": "/openimages-mini/Ostrich/images", - "masks": "/openimages-mini/Ostrich/masks" - } - }, - "Otter": { - "count": 1, - "prefix": "an", - "folder": { - "images": "/openimages-mini/Otter/images", - "masks": "/openimages-mini/Otter/masks" - } - }, - "Oven": { - "count": 1, - "prefix": "an", - "folder": { - "images": "/openimages-mini/Oven/images", - "masks": "/openimages-mini/Oven/masks" - } - }, - "Owl": { - "count": 1, - "prefix": "an", - "folder": { - "images": "/openimages-mini/Owl/images", - "masks": "/openimages-mini/Owl/masks" - } - }, - "Oyster": { - "count": 1, - "prefix": "an", - "folder": { - "images": "/openimages-mini/Oyster/images", - "masks": "/openimages-mini/Oyster/masks" - } - }, - "Pancake": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Pancake/images", - "masks": "/openimages-mini/Pancake/masks" - } - }, - "Panda": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Panda/images", - "masks": "/openimages-mini/Panda/masks" - } - }, - "Paper cutter": { - "count": 0, - "prefix": "a", - "folder": { - "images": null, - "masks": null - } - }, - "Paper towel": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Paper towel/images", - "masks": "/openimages-mini/Paper towel/masks" - } - }, - "Parrot": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Parrot/images", - "masks": "/openimages-mini/Parrot/masks" - } - }, - "Pastry": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Pastry/images", - "masks": "/openimages-mini/Pastry/masks" - } - }, - "Peach": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Peach/images", - "masks": "/openimages-mini/Peach/masks" - } - }, - "Pear": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Pear/images", - "masks": "/openimages-mini/Pear/masks" - } - }, - "Pen": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Pen/images", - "masks": "/openimages-mini/Pen/masks" - } - }, - "Pencil case": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Pencil case/images", - "masks": "/openimages-mini/Pencil case/masks" - } - }, - "Penguin": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Penguin/images", - "masks": "/openimages-mini/Penguin/masks" - } - }, - "Person": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Person/images", - "masks": "/openimages-mini/Person/masks" - } - }, - "Piano": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Piano/images", - "masks": "/openimages-mini/Piano/masks" - } - }, - "Picture frame": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Picture frame/images", - "masks": "/openimages-mini/Picture frame/masks" - } - }, - "Pig": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Pig/images", - "masks": "/openimages-mini/Pig/masks" - } - }, - "Pillow": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Pillow/images", - "masks": "/openimages-mini/Pillow/masks" - } - }, - "Pitcher (Container)": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Pitcher (Container)/images", - "masks": "/openimages-mini/Pitcher (Container)/masks" - } - }, - "Pizza": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Pizza/images", - "masks": "/openimages-mini/Pizza/masks" - } - }, - "Pizza cutter": { - "count": 0, - "prefix": "a", - "folder": { - "images": null, - "masks": null - } - }, - "Plastic bag": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Plastic bag/images", - "masks": "/openimages-mini/Plastic bag/masks" - } - }, - "Platter": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Platter/images", - "masks": "/openimages-mini/Platter/masks" - } - }, - "Polar bear": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Polar bear/images", - "masks": "/openimages-mini/Polar bear/masks" - } - }, - "Pomegranate": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Pomegranate/images", - "masks": "/openimages-mini/Pomegranate/masks" - } - }, - "Popcorn": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Popcorn/images", - "masks": "/openimages-mini/Popcorn/masks" - } - }, - "Potato": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Potato/images", - "masks": "/openimages-mini/Potato/masks" - } - }, - "Power plugs and sockets": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Power plugs and sockets/images", - "masks": "/openimages-mini/Power plugs and sockets/masks" - } - }, - "Pressure cooker": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Pressure cooker/images", - "masks": "/openimages-mini/Pressure cooker/masks" - } - }, - "Pretzel": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Pretzel/images", - "masks": "/openimages-mini/Pretzel/masks" - } - }, - "Printer": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Printer/images", - "masks": "/openimages-mini/Printer/masks" - } - }, - "Pumpkin": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Pumpkin/images", - "masks": "/openimages-mini/Pumpkin/masks" - } - }, - "Punching bag": { - "count": 0, - "prefix": "a", - "folder": { - "images": null, - "masks": null - } - }, - "Rabbit": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Rabbit/images", - "masks": "/openimages-mini/Rabbit/masks" - } - }, - "Raccoon": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Raccoon/images", - "masks": "/openimages-mini/Raccoon/masks" - } - }, - "Racket": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Racket/images", - "masks": "/openimages-mini/Racket/masks" - } - }, - "Radish": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Radish/images", - "masks": "/openimages-mini/Radish/masks" - } - }, - "Raven": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Raven/images", - "masks": "/openimages-mini/Raven/masks" - } - }, - "Red panda": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Red panda/images", - "masks": "/openimages-mini/Red panda/masks" - } - }, - "Remote control": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Remote control/images", - "masks": "/openimages-mini/Remote control/masks" - } - }, - "Reptile": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Reptile/images", - "masks": "/openimages-mini/Reptile/masks" - } - }, - "Rhinoceros": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Rhinoceros/images", - "masks": "/openimages-mini/Rhinoceros/masks" - } - }, - "Rocket": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Rocket/images", - "masks": "/openimages-mini/Rocket/masks" - } - }, - "Roller skates": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Roller skates/images", - "masks": "/openimages-mini/Roller skates/masks" - } - }, - "Rose": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Rose/images", - "masks": "/openimages-mini/Rose/masks" - } - }, - "Rugby ball": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Rugby ball/images", - "masks": "/openimages-mini/Rugby ball/masks" - } - }, - "Ruler": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Ruler/images", - "masks": "/openimages-mini/Ruler/masks" - } - }, - "Sandwich": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Sandwich/images", - "masks": "/openimages-mini/Sandwich/masks" - } - }, - "Saucer": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Saucer/images", - "masks": "/openimages-mini/Saucer/masks" - } - }, - "Saxophone": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Saxophone/images", - "masks": "/openimages-mini/Saxophone/masks" - } - }, - "Scarf": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Scarf/images", - "masks": "/openimages-mini/Scarf/masks" - } - }, - "Scissors": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Scissors/images", - "masks": "/openimages-mini/Scissors/masks" - } - }, - "Screwdriver": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Screwdriver/images", - "masks": "/openimages-mini/Screwdriver/masks" - } - }, - "Sculpture": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Sculpture/images", - "masks": "/openimages-mini/Sculpture/masks" - } - }, - "Sea lion": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Sea lion/images", - "masks": "/openimages-mini/Sea lion/masks" - } - }, - "Sea turtle": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Sea turtle/images", - "masks": "/openimages-mini/Sea turtle/masks" - } - }, - "Seat belt": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Seat belt/images", - "masks": "/openimages-mini/Seat belt/masks" - } - }, - "Segway": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Segway/images", - "masks": "/openimages-mini/Segway/masks" - } - }, - "Shark": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Shark/images", - "masks": "/openimages-mini/Shark/masks" - } - }, - "Sheep": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Sheep/images", - "masks": "/openimages-mini/Sheep/masks" - } - }, - "Shirt": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Shirt/images", - "masks": "/openimages-mini/Shirt/masks" - } - }, - "Shorts": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Shorts/images", - "masks": "/openimages-mini/Shorts/masks" - } - }, - "Shower": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Shower/images", - "masks": "/openimages-mini/Shower/masks" - } - }, - "Skateboard": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Skateboard/images", - "masks": "/openimages-mini/Skateboard/masks" - } - }, - "Skirt": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Skirt/images", - "masks": "/openimages-mini/Skirt/masks" - } - }, - "Skull": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Skull/images", - "masks": "/openimages-mini/Skull/masks" - } - }, - "Skunk": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Skunk/images", - "masks": "/openimages-mini/Skunk/masks" - } - }, - "Skyscraper": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Skyscraper/images", - "masks": "/openimages-mini/Skyscraper/masks" - } - }, - "Slow cooker": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Slow cooker/images", - "masks": "/openimages-mini/Slow cooker/masks" - } - }, - "Snake": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Snake/images", - "masks": "/openimages-mini/Snake/masks" - } - }, - "Snowmobile": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Snowmobile/images", - "masks": "/openimages-mini/Snowmobile/masks" - } - }, - "Soap dispenser": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Soap dispenser/images", - "masks": "/openimages-mini/Soap dispenser/masks" - } - }, - "Sock": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Sock/images", - "masks": "/openimages-mini/Sock/masks" - } - }, - "Sofa bed": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Sofa bed/images", - "masks": "/openimages-mini/Sofa bed/masks" - } - }, - "Sombrero": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Sombrero/images", - "masks": "/openimages-mini/Sombrero/masks" - } - }, - "Sparrow": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Sparrow/images", - "masks": "/openimages-mini/Sparrow/masks" - } - }, - "Spatula": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Spatula/images", - "masks": "/openimages-mini/Spatula/masks" - } - }, - "Spoon": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Spoon/images", - "masks": "/openimages-mini/Spoon/masks" - } - }, - "Squash (Plant)": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Squash (Plant)/images", - "masks": "/openimages-mini/Squash (Plant)/masks" - } - }, - "Squirrel": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Squirrel/images", - "masks": "/openimages-mini/Squirrel/masks" - } - }, - "Stapler": { - "count": 0, - "prefix": "a", - "folder": { - "images": null, - "masks": null - } - }, - "Starfish": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Starfish/images", - "masks": "/openimages-mini/Starfish/masks" - } - }, - "Stop sign": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Stop sign/images", - "masks": "/openimages-mini/Stop sign/masks" - } - }, - "Strawberry": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Strawberry/images", - "masks": "/openimages-mini/Strawberry/masks" - } - }, - "Studio couch": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Studio couch/images", - "masks": "/openimages-mini/Studio couch/masks" - } - }, - "Submarine sandwich": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Submarine sandwich/images", - "masks": "/openimages-mini/Submarine sandwich/masks" - } - }, - "Suit": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Suit/images", - "masks": "/openimages-mini/Suit/masks" - } - }, - "Suitcase": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Suitcase/images", - "masks": "/openimages-mini/Suitcase/masks" - } - }, - "Sun hat": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Sun hat/images", - "masks": "/openimages-mini/Sun hat/masks" - } - }, - "Surfboard": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Surfboard/images", - "masks": "/openimages-mini/Surfboard/masks" - } - }, - "Swan": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Swan/images", - "masks": "/openimages-mini/Swan/masks" - } - }, - "Swim cap": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Swim cap/images", - "masks": "/openimages-mini/Swim cap/masks" - } - }, - "Swimwear": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Swimwear/images", - "masks": "/openimages-mini/Swimwear/masks" - } - }, - "Sword": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Sword/images", - "masks": "/openimages-mini/Sword/masks" - } - }, - "Table tennis racket": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Table tennis racket/images", - "masks": "/openimages-mini/Table tennis racket/masks" - } - }, - "Tablet computer": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Tablet computer/images", - "masks": "/openimages-mini/Tablet computer/masks" - } - }, - "Tank": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Tank/images", - "masks": "/openimages-mini/Tank/masks" - } - }, - "Tap": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Tap/images", - "masks": "/openimages-mini/Tap/masks" - } - }, - "Tart": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Tart/images", - "masks": "/openimages-mini/Tart/masks" - } - }, - "Taxi": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Taxi/images", - "masks": "/openimages-mini/Taxi/masks" - } - }, - "Tea": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Tea/images", - "masks": "/openimages-mini/Tea/masks" - } - }, - "Teapot": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Teapot/images", - "masks": "/openimages-mini/Teapot/masks" - } - }, - "Teddy bear": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Teddy bear/images", - "masks": "/openimages-mini/Teddy bear/masks" - } - }, - "Tennis ball": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Tennis ball/images", - "masks": "/openimages-mini/Tennis ball/masks" - } - }, - "Tennis racket": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Tennis racket/images", - "masks": "/openimages-mini/Tennis racket/masks" - } - }, - "Tie": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Tie/images", - "masks": "/openimages-mini/Tie/masks" - } - }, - "Tiger": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Tiger/images", - "masks": "/openimages-mini/Tiger/masks" - } - }, - "Toaster": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Toaster/images", - "masks": "/openimages-mini/Toaster/masks" - } - }, - "Toilet": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Toilet/images", - "masks": "/openimages-mini/Toilet/masks" - } - }, - "Toilet paper": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Toilet paper/images", - "masks": "/openimages-mini/Toilet paper/masks" - } - }, - "Tomato": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Tomato/images", - "masks": "/openimages-mini/Tomato/masks" - } - }, - "Torch": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Torch/images", - "masks": "/openimages-mini/Torch/masks" - } - }, - "Tortoise": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Tortoise/images", - "masks": "/openimages-mini/Tortoise/masks" - } - }, - "Towel": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Towel/images", - "masks": "/openimages-mini/Towel/masks" - } - }, - "Toy": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Toy/images", - "masks": "/openimages-mini/Toy/masks" - } - }, - "Traffic light": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Traffic light/images", - "masks": "/openimages-mini/Traffic light/masks" - } - }, - "Traffic sign": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Traffic sign/images", - "masks": "/openimages-mini/Traffic sign/masks" - } - }, - "Train": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Train/images", - "masks": "/openimages-mini/Train/masks" - } - }, - "Trousers": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Trousers/images", - "masks": "/openimages-mini/Trousers/masks" - } - }, - "Truck": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Truck/images", - "masks": "/openimages-mini/Truck/masks" - } - }, - "Turkey": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Turkey/images", - "masks": "/openimages-mini/Turkey/masks" - } - }, - "Turtle": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Turtle/images", - "masks": "/openimages-mini/Turtle/masks" - } - }, - "Van": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Van/images", - "masks": "/openimages-mini/Van/masks" - } - }, - "Vase": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Vase/images", - "masks": "/openimages-mini/Vase/masks" - } - }, - "Vehicle registration plate": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Vehicle registration plate/images", - "masks": "/openimages-mini/Vehicle registration plate/masks" - } - }, - "Volleyball (Ball)": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Volleyball (Ball)/images", - "masks": "/openimages-mini/Volleyball (Ball)/masks" - } - }, - "Waffle": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Waffle/images", - "masks": "/openimages-mini/Waffle/masks" - } - }, - "Washing machine": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Washing machine/images", - "masks": "/openimages-mini/Washing machine/masks" - } - }, - "Waste container": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Waste container/images", - "masks": "/openimages-mini/Waste container/masks" - } - }, - "Watch": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Watch/images", - "masks": "/openimages-mini/Watch/masks" - } - }, - "Watermelon": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Watermelon/images", - "masks": "/openimages-mini/Watermelon/masks" - } - }, - "Whale": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Whale/images", - "masks": "/openimages-mini/Whale/masks" - } - }, - "Wheel": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Wheel/images", - "masks": "/openimages-mini/Wheel/masks" - } - }, - "Whiteboard": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Whiteboard/images", - "masks": "/openimages-mini/Whiteboard/masks" - } - }, - "Wine": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Wine/images", - "masks": "/openimages-mini/Wine/masks" - } - }, - "Winter melon": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Winter melon/images", - "masks": "/openimages-mini/Winter melon/masks" - } - }, - "Wok": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Wok/images", - "masks": "/openimages-mini/Wok/masks" - } - }, - "Woman": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Woman/images", - "masks": "/openimages-mini/Woman/masks" - } - }, - "Woodpecker": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Woodpecker/images", - "masks": "/openimages-mini/Woodpecker/masks" - } - }, - "Wrench": { - "count": 0, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Wrench/images", - "masks": "/openimages-mini/Wrench/masks" - } - }, - "Zebra": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Zebra/images", - "masks": "/openimages-mini/Zebra/masks" - } - }, - "Zucchini": { - "count": 1, - "prefix": "a", - "folder": { - "images": "/openimages-mini/Zucchini/images", - "masks": "/openimages-mini/Zucchini/masks" - } - } -} diff --git a/determined/run_atman.yml b/determined/run_atman.yml deleted file mode 100755 index d68deb2..0000000 --- a/determined/run_atman.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: atman-eval -project: atman -max_restarts: 2 -environment: - force_pull_image: true -resources: - priority: 40 - slots_per_trial: 1 - devices: - - container_path: /dev/infiniband - host_path: /dev/infiniband - mode: mrw -searcher: - name: grid - metric: not_needed - max_concurrent_trials: 66 - max_length: 10000 - -bind_mounts: -entrypoint: python3 run_eval.py -hyperparameters: - result_path: - type: categorical - vals: - - /det_cos_nolog_mult - conc_sup: - type: categorical - vals: - - .1 - - .2 - - .3 - - .4 - - .5 - - .6 - - .7 - - .8 - - .9 - - .99 - - None - sup_fact: - type: categorical - vals: - - .1,.2 - - .3,.4 - - .5,.6 - - .7,.8 - - .9 - - 1.,0. diff --git a/determined/run_atman_layers.yml b/determined/run_atman_layers.yml deleted file mode 100755 index 6a00ef9..0000000 --- a/determined/run_atman_layers.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: atman-eval-layers -project: atman -max_restarts: 2 -environment: - force_pull_image: true -resources: - priority: 40 - slots_per_trial: 1 - devices: - - container_path: /dev/infiniband - host_path: /dev/infiniband - mode: mrw -searcher: - name: grid - metric: not_needed - max_concurrent_trials: 8 - max_length: 10000 - -bind_mounts: -entrypoint: python3 run_eval.py -hyperparameters: - result_path: - type: categorical - vals: - - /det_cos_nolog_mult_layers - conc_sup: - type: categorical - vals: - - .7 - sup_fact: - type: categorical - vals: - - .7 - layers: - type: categorical - vals: - - [[0,1],[2,3],[4,5],[6,7]] - - [[8,9],[10,11],[12,13],[14,15]] - - [[16,17],[18,19],[20,21],[22,23]] - - [[24,25],[26,27],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]] - - [[0,1,2,3],[0,1,2,3,4,5],[0,1,2,3,4,5,6,7],[0,1,2,3,4,5,6,7,8,9]] - - [[0,1,2,3,4,5,6,7,8,9,10,11],[0,1,2,3,4,5,6,7,8,9,10,11,12,13],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]] - - [[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]] diff --git a/determined/run_eval.py b/determined/run_eval.py deleted file mode 100755 index 21e38be..0000000 --- a/determined/run_eval.py +++ /dev/null @@ -1,120 +0,0 @@ -from datetime import datetime -from atman_magma.magma import Magma -from atman_magma.explainer import Explainer -from atman_magma.logit_parsing import get_delta_cross_entropies -from atman_magma.openimages_eval import run_eval - - -from multimodal_explain_eval.dataloader import DataLoader -from multimodal_explain_eval.utils import load_json_as_dict - -import sys - -from determined_eval_wrapper import process_determined_hparams - -import os -import determined as det - - -startTime = datetime.now() - - -info = det.get_cluster_info() -if info is None: - hparams = {} -else: - hparams = info.trial.hparams if info.task_type == "TRIAL" else {} -params = process_determined_hparams(hparams) - - - -if __name__ == "__main__": - conc_sup_values = str(params.conc_sup).split(',') - suppression_factor_values = str(params.sup_fact).split(',') - - metadata = load_json_as_dict('metadata.json') - - keys_to_delete = [] - for x in metadata.keys(): - if metadata[x]['count'] == 0: - keys_to_delete.append(x) - - for key in keys_to_delete: - del metadata[key] - - - dataloader = DataLoader( - metadata=metadata - ) - - num_images = 0 - for key in metadata: - num_images += metadata[key]["count"] - # print(f"{key:<17}:", metadata[key]["count"]) - - print(f"total {num_images} pairs across {len(metadata)} classes") - - num_total_explanations = ( - len(conc_sup_values) *len(suppression_factor_values) * num_images - ) - print(f"Will run a total of: {num_total_explanations} explanations") - - print('output folder names:') - - all_layers = [None] - if params.layers is not None and params.layers != "None": - all_layers = params.layers - # else: - - for layers in all_layers: - for x in conc_sup_values: - for y in suppression_factor_values: - print(f"CONFIG {x} {y} // {len(conc_sup_values)} {len(suppression_factor_values)}") - if x == "None": - conc_sup_value = None - else: - conc_sup_value = float(x) - suppression_factor_value = float(y) - folder_name = f"{params.result_path}/con_sup_thres_{str(x) if x is not None else None}_suppression_factor_{str(y) if y is not None else None}_layer_{','.join([str(l) for l in layers]) if layers is not None else 'None'}" - - print('loading model...') - model = Magma.from_checkpoint( - checkpoint_path = "./mp_rank_00_model_states.pt", - device = 'cuda' - ) - model = model.eval() - - folder_idx = 0 - - num_total_explanations = num_images - ex = Explainer( - model = model, - device = 'cuda', - tokenizer = model.tokenizer, - conceptual_suppression_threshold = conc_sup_value, - suppression_factor = suppression_factor_value, - layers=layers - ) - - run_eval( - explainer = ex, - metadata = metadata, - dataloader = dataloader, - logit_parsing_fn=get_delta_cross_entropies, - output_folder = folder_name, - max_batch_size = 144, - text_prompt = 'This is a picture of ', - use_lowercase_target=True, - auto_decide_a_or_an=True, - progress=True, - square_outputs = False, - num_total_explanations=num_total_explanations, - prompt_explain_indices = [i for i in range(144)] - ) - folder_idx += 1 - - print('eval complete :)') - - - - print("ALL DONE") diff --git a/startup-hook.sh b/startup-hook.sh index 3199be6..12a5ecc 100755 --- a/startup-hook.sh +++ b/startup-hook.sh @@ -3,6 +3,5 @@ pip install deepspeed==0.6.0 pip install typeguard==2.11.1 pip install opencv-python-headless==4.2.0.34 pip install ./magma -pip install ./atman-open-images-eval pip install ./atman-magma pip install gdown==4.4.0 captum