diff --git a/IntelliP.py b/IntelliP.py new file mode 100644 index 0000000..2e03540 --- /dev/null +++ b/IntelliP.py @@ -0,0 +1,2217 @@ +""" +(c) Moses and Joh Olafenwa 2018 +Website : https://moses.specpal.science , https://john.specpal.science +--------------------------- + +This is the file that contains all the python code +for the IntelliP. + +""" + +#Below is the imports needed for the program +from kivy.app import App +from kivy.uix.label import Label +from kivy.uix.gridlayout import GridLayout +from kivy.uix.image import AsyncImage +from kivy.core.window import Window +from kivy.uix.scrollview import ScrollView +from kivy.app import runTouchApp +from kivy.uix.button import Button +from kivy.uix.floatlayout import FloatLayout +from kivy.graphics import Color, Rectangle +from kivy.clock import mainthread +from kivy.config import Config +import os +from imageai.Prediction import ImagePrediction +import threading +import json + +# Below we obtain the working directory of our python program fro use later in the program. +execution_path = os.getcwd() + +# This value is created to enable us to track loaded pages in each gallery category +global gallerySteps +gallerySteps = 1 + +# Below is an aray of all the folders in the computer we intend to sacn for photos +folders_array = [] +pictures_folder = os.environ["USERPROFILE"] + "\\Pictures\\" +folders_array.append(pictures_folder) +download_folder = os.environ["USERPROFILE"] + "\\Downloads\\" +folders_array.append(download_folder) +documents_folder = os.environ["USERPROFILE"] + "\\Documents\\" +folders_array.append(documents_folder) +videos_folder = os.environ["USERPROFILE"] + "\\Videos\\" +folders_array.append(videos_folder) +desktop_folder = os.environ["USERPROFILE"] + "\\Desktop\\" +folders_array.append(desktop_folder) + + +# Below is a dictionary of arrays of photos extracted and categorized by our image prediction object +pictures_array = [] +pictures_object_array = [] + +pictures_dictionary = {} +pictures_animals_array = [] +pictures_dictionary["animals"] = pictures_animals_array +pictures_seaanimals_array = [] +pictures_dictionary["seaanimals"] = pictures_seaanimals_array +pictures_birds_array = [] +pictures_dictionary["birds"] = pictures_birds_array +pictures_objects_array = [] +pictures_dictionary["objects"] = pictures_objects_array +pictures_electronics_array = [] +pictures_dictionary["electronics"] = pictures_electronics_array +pictures_dresses_array = [] +pictures_dictionary["dresses"] = pictures_dresses_array +pictures_foods_array = [] +pictures_dictionary["foods"] = pictures_foods_array +pictures_plants_array = [] +pictures_dictionary["plants"] = pictures_plants_array +pictures_aircrafts_array = [] +pictures_dictionary["aircrafts"] = pictures_aircrafts_array +pictures_places_array = [] +pictures_dictionary["places"] = pictures_places_array +pictures_vehicles_array = [] +pictures_dictionary["vehicles"] = pictures_vehicles_array +pictures_people_array = [] +pictures_dictionary["people"] = pictures_people_array + +# Below is our image prediction object +imagePrediction = ImagePrediction() +imagePrediction.setModelTypeAsResNet() +imagePrediction.setModelPath(execution_path + "\\resnet50_weights_tf_dim_ordering_tf_kernels.h5") +imagePrediction.setJsonPath(execution_path + "\\imagenet_class_index.json") + + + + +# Below is our main application layout +mainLayout = FloatLayout() +mainLayout.size_hint = (1, None) +mainLayout.size = (Window.width, Window.height) + + + +# Below is our layout when we are scanning the computer for photos. It also shows the progress. +scanLayout = GridLayout() +scanLayout.cols = 1 +scanLayout.size_hint = (1, None) +scanLayout.size = (Window.width, Window.height) +with scanLayout.canvas.before: + Color(0,1,0,1) + scanLayout.rect = Rectangle(size= Window.size, pos = scanLayout.pos) + +label1 = Label() +label1.size_hint_x = 1 +label1.font_size = 15 +label1.text = "IntelliP is scanning your pictures.\n" \ + "It will perform this operation once.\n" \ + "Once done, it won't need to scan again\n" \ + "It will load your pictures in intelligent\n" \ + "categories." +scanLayout.add_widget(label1) + +label2 = Label() +label2.size_hint_x = 1 +label2.font_size = 20 +label2.text = "Pictures found : " +scanLayout.add_widget(label2) + + +scanLoader = AsyncImage() +try: + scanLoader.source = execution_path + "\\loading.gif" + scanLoader.size_hint = (3, None) + scanLoader.height = 300 + scanLayout.add_widget(scanLoader) +except: + print("Skipped") + + + +# Below is the class of the Button than displays the "About" information of the Application +class AboutButton(Button): + def __init__(self, **kwargs): + super(AboutButton, self).__init__(**kwargs) + + def on_press(self): + aboutLayout = GridLayout() + aboutLayout.cols = 1 + aboutLayout.size_hint = (1, None) + aboutLayout.size = (Window.width, Window.height) + with aboutLayout.canvas.before: + Color(0, 1, 0, 1) + aboutLayout.rect = Rectangle(size=Window.size, pos=aboutLayout.pos) + + aboutText1 = Label() + aboutText1.font_size = 30 + aboutText1.text = "IntelliP" + + aboutText2 = Label() + aboutText2.font_size = 20 + aboutText2.text = "(Intelligent Photos)" + + aboutText3 = Label() + aboutText3.font_size = 15 + aboutText3.text = "IntelliP is an intelligent photo \n" \ + "Application that organizes your \n" \ + "system photos into 12 distinct \n" \ + "categories using AI. This Application \n" \ + "serves as a demo App for the ImageAI \n" \ + "library by Moses & John Olafenwa." + + aboutText4 = Label() + aboutText4.font_size = 20 + aboutText4.text = "(c) Moses & John Olafenwa, 2018." + + closeAbout = CloseAbout(aboutLayout) + closeAbout.text = "Back" + closeAbout.font_size = 20 + closeAbout.size_hint = (1, None) + closeAbout.height = 50 + + aboutLayout.add_widget(aboutText1) + aboutLayout.add_widget(aboutText2) + aboutLayout.add_widget(aboutText3) + aboutLayout.add_widget(aboutText4) + aboutLayout.add_widget(closeAbout) + + mainLayout.add_widget(aboutLayout) + + + +# Below is the class of the button that closes the "About" application layout when clicked +class CloseAbout(Button): + def __init__(self, aboutLayout, **kwargs): + super(CloseAbout, self).__init__(**kwargs) + self.about_layout = aboutLayout + + def on_press(self): + mainLayout.remove_widget(self.about_layout) + + + +# Below is the class of the layout used to display each page of at most 10 pictures in each photo category +class Scroller(ScrollView,): + def __init__(self, actionLayout, **kwargs): + super(Scroller, self).__init__(**kwargs) + self.size_hint = (1, None) + self.size = (Window.width, Window.height) + self.scroll_type = ["bars", "content"] + self.action_layout = actionLayout + + def on_scroll_stop(self, touch, check_children=True): + threshold = self.vbar[0] * 100 + if(int(threshold) < 5): + response = loadNext() + if response: + mainLayout.remove_widget(self) + mainLayout.remove_widget(self.action_layout) + + elif(int(threshold) == 70): + response = loadPrevious() + if response: + mainLayout.remove_widget(self) + mainLayout.remove_widget(self.action_layout) + + super(Scroller, self).on_scroll_stop(touch) + + + + + + +# Below is the layout that shows all the photo categories +galleryScroll = ScrollView() +galleryScroll.size_hint = (1, None) +galleryScroll.size = (Window.width, Window.height) +galleryScroll.scroll_type = ["bars", "content"] + +galleryScroll.bar_width = 20 +galleryScroll.bar_inactive_color = [0.3, 0.9, 0,5, 0.9] +with galleryScroll.canvas.before: + Color(0,1,0,1) + galleryScroll.rect = Rectangle(size= Window.size, pos = galleryScroll.pos) + +galleryGrid = GridLayout(cols=2, spacing=10, size_hint_y=None) +galleryGrid.cols = 2 +galleryGrid.bind(minimum_height = galleryGrid.setter('height')) + + + + + + + +# Below is the Thread that scans the computer for photos, run image prediction on them and store them in +# "pictures.json" file and "pictures_monitor.json" file. +class ScanThread(threading.Thread): + def __init__(self): + threading.Thread.__init__(self) + + # Below function is used to update the scan layout on the progress of the comuter scanning and image predictions + @mainthread + def updateUI(self, message): + label2.text = message + # The function below is used after the predictions are complete to show the photo gallery layout + @mainthread + def finalUpdateUI(self, value): + label2.text = "Total Pictures found : " + str(value) + + # The code below writes the photo categories dictionary to a json file for use later + with open(execution_path + "\\pictures.json", "w+") as outfile: + json.dump(pictures_dictionary, outfile, indent=4, sort_keys=True, separators=(",", " : "), ensure_ascii=True) + outfile.close() + + # The code below make checks and show the photo categories with pictures in them + if(len(pictures_animals_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_animals_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + print("Skipped") + + categoryLabel = Label() + categoryLabel.text = " >>> Animals" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Animals", pictures_animals_array) + loadButton.text = "View Animals" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + galleryGrid.add_widget(categoryGrid) + + if (len(pictures_seaanimals_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_seaanimals_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + print("Skipped") + + categoryLabel = Label() + categoryLabel.text = " >>> Sea Animals" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Sea Animals", pictures_seaanimals_array) + loadButton.text = "View Sea Animals" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + galleryGrid.add_widget(categoryGrid) + + if (len(pictures_birds_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_birds_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + print("Skipped") + + categoryLabel = Label() + categoryLabel.text = " >>> Birds" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Birds", pictures_birds_array) + loadButton.text = "View Birds" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + galleryGrid.add_widget(categoryGrid) + + if (len(pictures_objects_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_objects_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + print ("Skipped") + + categoryLabel = Label() + categoryLabel.text = " >>> Objects" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Objects", pictures_objects_array) + loadButton.text = "View Objects" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + galleryGrid.add_widget(categoryGrid) + + if (len(pictures_electronics_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_electronics_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + print("Skipped") + + categoryLabel = Label() + categoryLabel.text = " >>> Electronics" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Electronics", pictures_electronics_array) + loadButton.text = "View Electronics" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + galleryGrid.add_widget(categoryGrid) + + if (len(pictures_dresses_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_dresses_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + print("Skipped") + + categoryLabel = Label() + categoryLabel.text = " >>> Dresses" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Dresses", pictures_dresses_array) + loadButton.text = "View Dresses" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + galleryGrid.add_widget(categoryGrid) + + if (len(pictures_foods_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_foods_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + print("Skipped") + + categoryLabel = Label() + categoryLabel.text = " >>> Foods" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Foods", pictures_foods_array) + loadButton.text = "View Foods" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + galleryGrid.add_widget(categoryGrid) + + if (len(pictures_plants_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_plants_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + print("Skipped") + + categoryLabel = Label() + categoryLabel.text = " >>> Plants" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Plants", pictures_plants_array) + loadButton.text = "Plants" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + galleryGrid.add_widget(categoryGrid) + + if (len(pictures_aircrafts_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_aircrafts_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + print("Skipped") + + categoryLabel = Label() + categoryLabel.text = " >>> Aircrafts" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Aircrafts", pictures_aircrafts_array) + loadButton.text = "View Aircrafts" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + galleryGrid.add_widget(categoryGrid) + + if (len(pictures_places_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_places_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + None + + categoryLabel = Label() + categoryLabel.text = " >>> Places" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Places", pictures_places_array) + loadButton.text = "View Places" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + galleryGrid.add_widget(categoryGrid) + + if (len(pictures_vehicles_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_vehicles_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + None + + categoryLabel = Label() + categoryLabel.text = " >>> Vehicles" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Vehicles", pictures_vehicles_array) + loadButton.text = "View Vehicles" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + galleryGrid.add_widget(categoryGrid) + + if (len(pictures_people_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_people_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + None + + categoryLabel = Label() + categoryLabel.text = " >>> People" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> People", pictures_people_array) + loadButton.text = "View People" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + galleryGrid.add_widget(categoryGrid) + + + # Below is the code for extra button actions and dummy labels for interface optimization + + dummyGridObject = Label() + dummyGridObject.size_hint_y = None + dummyGridObject.height = "100" + dummyGridObject.text = " . \n" \ + " . \n" \ + " . \n" + galleryGrid.add_widget(dummyGridObject) + + detailsGrid = GridLayout() + detailsGrid.cols = 3 + detailsGrid.size_hint = (1, None) + + dummy1 = Label() + dummy1.size_hint = (1, None) + detailsGrid.add_widget(dummy1) + + aboutbutton = AboutButton() + aboutbutton.text = "About" + aboutbutton.font_size = 15 + aboutbutton.size_hint = (2, None) + aboutbutton.height = 30 + detailsGrid.add_widget(aboutbutton) + + dummy2 = Label() + dummy2.size_hint = (1, None) + detailsGrid.add_widget(dummy2) + + mainLayout.remove_widget(scanLayout) + galleryScroll.add_widget(galleryGrid) + + mainLayout.add_widget(galleryScroll) + mainLayout.add_widget(detailsGrid) + + + + # This is the function that starts the thread and initate the image scanning and image prediction process + def run(self): + count = 0 + + # The Code below obtains the pictures from each folder in the folders_array and add it to the "pictures_array" + for eachFolder in folders_array: + + if eachFolder == os.environ["USERPROFILE"] + "\\Pictures\\": + for top_dir, sub_dir_array, files_array in os.walk(eachFolder, topdown=True, followlinks=True): + + for file in files_array: + if file.endswith(".png") or file.endswith(".jpg") or file.endswith(".gif") or file.endswith( + ".PNG") or file.endswith(".JPG") or file.endswith(".GIF"): + count += 1 + + if ((count % 10) == 0): + self.updateUI("Pictures found : " + str(count)) + + + pictures_array.append(os.path.join(top_dir, file)) + else: + files = os.listdir(eachFolder) + for file in files: + if file.endswith(".png") or file.endswith(".jpg") or file.endswith(".gif") or file.endswith( + ".PNG") or file.endswith(".JPG") or file.endswith(".GIF"): + count += 1 + + if ((count % 10) == 0): + self.updateUI("Pictures found : " + str(count)) + + + pictures_array.append(eachFolder + file) + + + counter = 0 + + self.updateUI("Loading Intelligence Module....") + imagePrediction.loadModel() + self.updateUI("Intelligence Module loaded....") + + # The code below obtains our manually edited " gallery_class.json " in preparation for photo + # categorization after image prediction + with open(execution_path + "\\gallery_class.json") as inputFile: + gallery_class = json.load(inputFile) + + # The code below performs image prediction for all images in the " pictures_array " + for eachFile in pictures_array: + counter += 1 + try: + predictions, percentage_probabilities = imagePrediction.predictImage(eachFile, + result_count=1) + # The code below creates a special Image Object for after each image prediction + # and adds it to the corresponding picture category array + + for index in range(len(predictions)): + print(predictions[index]) + imageDictionary = {} + imageDictionary["path"] = str(eachFile) + imageDictionary["prediction"] = predictions[index] + + imageCategory = gallery_class[predictions[index]] + imageDictionary["category"] = imageCategory + if (imageCategory == "animals"): + pictures_animals_array.append(imageDictionary) + elif (imageCategory == "sea animals"): + pictures_seaanimals_array.append(imageDictionary) + elif (imageCategory == "birds"): + pictures_birds_array.append(imageDictionary) + elif (imageCategory == "objects"): + pictures_objects_array.append(imageDictionary) + elif (imageCategory == "electronics"): + pictures_electronics_array.append(imageDictionary) + elif (imageCategory == "dresses"): + pictures_dresses_array.append(imageDictionary) + elif (imageCategory == "foods"): + pictures_foods_array.append(imageDictionary) + elif (imageCategory == "plants"): + pictures_plants_array.append(imageDictionary) + elif (imageCategory == "aircrafts"): + pictures_aircrafts_array.append(imageDictionary) + elif (imageCategory == "places"): + pictures_places_array.append(imageDictionary) + elif (imageCategory == "vehicles"): + pictures_vehicles_array.append(imageDictionary) + elif (imageCategory == "people"): + pictures_people_array.append(imageDictionary) + except: + continue + + self.updateUI("Processing " + str(counter) + " of " + str(len(pictures_array)) + " pictures") + # The code below creates " pictures_monitor.json " file that is used to keep track of processed photos + # during a computer rescan. + pictures_monitor_dictionary = {} + for eachItem in pictures_array: + newItem = eachItem + pictures_monitor_dictionary[str(newItem)] = "" + + with open(execution_path + "\\pictures_monitor.json", "w+") as monitorfile: + json.dump(pictures_monitor_dictionary, monitorfile, indent=4, sort_keys=True, separators=(",", " : "), ensure_ascii=True) + monitorfile.close() + + + self.finalUpdateUI(len(pictures_array)) + + + +# The class below performs a computer rescan and image prediction to add new photos to its list. It does +# so and updates the "pictures.json" file and "pictures_json.json" file accordingly. +class ReScanThread(threading.Thread): + def __init__(self): + threading.Thread.__init__(self) + + + @mainthread + def updateUI(self, message): + label2.text = message + + + @mainthread + def updateFinalUI(self): + with open(execution_path + "\\pictures.json") as inputFile: + json_data = json.load(inputFile) + + rescangalleryScroll = ScrollView() + rescangalleryScroll.size_hint = (1, None) + rescangalleryScroll.size = (Window.width, Window.height) + rescangalleryScroll.scroll_type = ["bars", "content"] + + rescangalleryScroll.bar_width = 20 + rescangalleryScroll.bar_inactive_color = [0.3, 0.9, 0, 5, 0.9] + with galleryScroll.canvas.before: + Color(0, 1, 0, 1) + rescangalleryScroll.rect = Rectangle(size=Window.size, pos=rescangalleryScroll.pos) + + rescangalleryGrid = GridLayout(cols=2, spacing=10, size_hint_y=None) + rescangalleryGrid.cols = 2 + rescangalleryGrid.bind(minimum_height=rescangalleryGrid.setter('height')) + + animals_data = json_data["animals"] + for eachObject in animals_data: + imageDictionary = {} + imageDictionary["path"] = eachObject["path"] + imageDictionary["prediction"] = eachObject["prediction"] + imageDictionary["category"] = "animals" + pictures_animals_array.append(imageDictionary) + + seaanimals_data = json_data["seaanimals"] + for eachObject in seaanimals_data: + imageDictionary = {} + imageDictionary["path"] = eachObject["path"] + imageDictionary["prediction"] = eachObject["prediction"] + imageDictionary["category"] = "seaanimals" + pictures_seaanimals_array.append(imageDictionary) + + birds_data = json_data["birds"] + for eachObject in birds_data: + imageDictionary = {} + imageDictionary["path"] = eachObject["path"] + imageDictionary["prediction"] = eachObject["prediction"] + imageDictionary["category"] = "birds" + pictures_birds_array.append(imageDictionary) + + objects_data = json_data["objects"] + for eachObject in objects_data: + imageDictionary = {} + imageDictionary["path"] = eachObject["path"] + imageDictionary["prediction"] = eachObject["prediction"] + imageDictionary["category"] = "objects" + pictures_objects_array.append(imageDictionary) + + electronics_data = json_data["electronics"] + for eachObject in electronics_data: + imageDictionary = {} + imageDictionary["path"] = eachObject["path"] + imageDictionary["prediction"] = eachObject["prediction"] + imageDictionary["category"] = "electronics" + pictures_electronics_array.append(imageDictionary) + + dresses_data = json_data["dresses"] + for eachObject in dresses_data: + imageDictionary = {} + imageDictionary["path"] = eachObject["path"] + imageDictionary["prediction"] = eachObject["prediction"] + imageDictionary["category"] = "dresses" + pictures_dresses_array.append(imageDictionary) + + foods_data = json_data["foods"] + for eachObject in foods_data: + imageDictionary = {} + imageDictionary["path"] = eachObject["path"] + imageDictionary["prediction"] = eachObject["prediction"] + imageDictionary["category"] = "foods" + pictures_foods_array.append(imageDictionary) + + plants_data = json_data["plants"] + for eachObject in plants_data: + imageDictionary = {} + imageDictionary["path"] = eachObject["path"] + imageDictionary["prediction"] = eachObject["prediction"] + imageDictionary["category"] = "plants" + pictures_plants_array.append(imageDictionary) + + aircrafts_data = json_data["aircrafts"] + for eachObject in aircrafts_data: + imageDictionary = {} + imageDictionary["path"] = eachObject["path"] + imageDictionary["prediction"] = eachObject["prediction"] + imageDictionary["category"] = "aircrafts" + pictures_aircrafts_array.append(imageDictionary) + + places_data = json_data["places"] + for eachObject in places_data: + imageDictionary = {} + imageDictionary["path"] = eachObject["path"] + imageDictionary["prediction"] = eachObject["prediction"] + imageDictionary["category"] = "places" + pictures_places_array.append(imageDictionary) + + vehicles_data = json_data["vehicles"] + for eachObject in vehicles_data: + imageDictionary = {} + imageDictionary["path"] = eachObject["path"] + imageDictionary["prediction"] = eachObject["prediction"] + imageDictionary["category"] = "vehicles" + pictures_vehicles_array.append(imageDictionary) + + people_data = json_data["people"] + for eachObject in people_data: + imageDictionary = {} + imageDictionary["path"] = eachObject["path"] + imageDictionary["prediction"] = eachObject["prediction"] + imageDictionary["category"] = "people" + pictures_people_array.append(imageDictionary) + + if (len(pictures_animals_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_animals_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + None + + categoryLabel = Label() + categoryLabel.text = " >>> Animals" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Animals", pictures_animals_array) + loadButton.text = "View Animals" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + rescangalleryGrid.add_widget(categoryGrid) + + if (len(pictures_seaanimals_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_seaanimals_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + None + + categoryLabel = Label() + categoryLabel.text = " >>> Sea Animals" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Sea Animals", pictures_seaanimals_array) + loadButton.text = "View Sea Animals" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + rescangalleryGrid.add_widget(categoryGrid) + + ## Adding the Categories to UI + + if (len(pictures_birds_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_birds_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + None + + categoryLabel = Label() + categoryLabel.text = " >>> Birds" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Birds", pictures_birds_array) + loadButton.text = "View Birds" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + rescangalleryGrid.add_widget(categoryGrid) + + if (len(pictures_objects_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_objects_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + None + + categoryLabel = Label() + categoryLabel.text = " >>> Objects" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Objects", pictures_objects_array) + loadButton.text = "View Objects" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + rescangalleryGrid.add_widget(categoryGrid) + + if (len(pictures_electronics_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_electronics_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + None + + categoryLabel = Label() + categoryLabel.text = " >>> Electronics" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Electronics", pictures_electronics_array) + loadButton.text = "View Electronics" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + rescangalleryGrid.add_widget(categoryGrid) + + if (len(pictures_dresses_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_dresses_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + None + + categoryLabel = Label() + categoryLabel.text = " >>> Dresses" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Dresses", pictures_dresses_array) + loadButton.text = "View Dresses" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + rescangalleryGrid.add_widget(categoryGrid) + + if (len(pictures_foods_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_foods_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + None + + categoryLabel = Label() + categoryLabel.text = " >>> Foods" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Foods", pictures_foods_array) + loadButton.text = "View Foods" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + rescangalleryGrid.add_widget(categoryGrid) + + if (len(pictures_plants_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_plants_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + None + + categoryLabel = Label() + categoryLabel.text = " >>> Plants" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Plants", pictures_plants_array) + loadButton.text = "Plants" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + rescangalleryGrid.add_widget(categoryGrid) + + if (len(pictures_aircrafts_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_aircrafts_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + None + + categoryLabel = Label() + categoryLabel.text = " >>> Aircrafts" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Aircrafts", pictures_aircrafts_array) + loadButton.text = "View Aircrafts" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + rescangalleryGrid.add_widget(categoryGrid) + + if (len(pictures_places_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_places_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + None + + categoryLabel = Label() + categoryLabel.text = " >>> Places" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Places", pictures_places_array) + loadButton.text = "View Places" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + rescangalleryGrid.add_widget(categoryGrid) + + if (len(pictures_vehicles_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_vehicles_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + None + + categoryLabel = Label() + categoryLabel.text = " >>> Vehicles" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Vehicles", pictures_vehicles_array) + loadButton.text = "View Vehicles" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + rescangalleryGrid.add_widget(categoryGrid) + + if (len(pictures_people_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_people_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + None + + categoryLabel = Label() + categoryLabel.text = " >>> People" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> People", pictures_people_array) + loadButton.text = "View People" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + rescangalleryGrid.add_widget(categoryGrid) + + + dummyGridObject = Label() + dummyGridObject.size_hint_y = None + dummyGridObject.height = "100" + dummyGridObject.text = " . \n" \ + " . \n" \ + " . \n" + rescangalleryGrid.add_widget(dummyGridObject) + + rescangalleryScroll.add_widget(rescangalleryGrid) + mainLayout.add_widget(galleryScroll) + + detailsGrid = GridLayout() + detailsGrid.cols = 3 + detailsGrid.size_hint = (1, None) + + dummy1 = Label() + dummy1.size_hint = (1, None) + detailsGrid.add_widget(dummy1) + + aboutbutton = AboutButton() + aboutbutton.text = "About" + aboutbutton.font_size = 15 + aboutbutton.size_hint = (2, None) + aboutbutton.height = 30 + detailsGrid.add_widget(aboutbutton) + + dummy2 = Label() + dummy2.size_hint = (1, None) + detailsGrid.add_widget(dummy2) + + mainLayout.remove_widget(scanLayout) + mainLayout.add_widget(detailsGrid) + + def run(self): + all_pictures_array = [] + found_pictures_array = [] + + + + with open(execution_path + "\\pictures.json", "r") as picturesFile: + pictures_class = json.load(picturesFile) + picturesFile.close() + + rescanpictures_animals_array = pictures_class["animals"] + rescanpictures_seaanimals_array = pictures_class["seaanimals"] + rescanpictures_birds_array = pictures_class["birds"] + rescanpictures_objects_array = pictures_class["objects"] + rescanpictures_electronics_array = pictures_class["electronics"] + rescanpictures_dresses_array = pictures_class["dresses"] + rescanpictures_foods_array = pictures_class["foods"] + rescanpictures_plants_array = pictures_class["plants"] + rescanpictures_aircrafts_array = pictures_class["aircrafts"] + rescanpictures_places_array = pictures_class["places"] + rescanpictures_vehicles_array = pictures_class["vehicles"] + rescanpictures_people_array = pictures_class["people"] + + count = 0 + + for eachFolder in folders_array: + + if eachFolder == os.environ["USERPROFILE"] + "\\Pictures\\" : + for top_dir, sub_dir_array, files_array in os.walk(eachFolder, topdown=True, followlinks=True): + + for file in files_array: + if file.endswith(".png") or file.endswith(".jpg") or file.endswith(".gif") or file.endswith( + ".PNG") or file.endswith(".JPG") or file.endswith(".GIF"): + count += 1 + + all_pictures_array.append(os.path.join(top_dir, file)) + else: + files = os.listdir(eachFolder) + for file in files: + if file.endswith(".png") or file.endswith(".jpg") or file.endswith(".gif") or file.endswith( + ".PNG") or file.endswith(".JPG") or file.endswith(".GIF"): + count += 1 + + all_pictures_array.append(eachFolder + file) + + # Prediction Object + rescanimagePrediction = ImagePrediction() + rescanimagePrediction.setModelTypeAsResNet() + rescanimagePrediction.setModelPath(execution_path + "\\resnet50_weights_tf_dim_ordering_tf_kernels.h5") + rescanimagePrediction.setJsonPath(execution_path + "\\imagenet_class_index.json") + + + with open(execution_path + "\\gallery_class.json") as inputFile: + gallery_class = json.load(inputFile) + inputFile.close() + + count = 0 + + with open(execution_path + "\\pictures_monitor.json") as monitorFile: + allpictures = json.load(monitorFile) + monitorFile.close() + for eachImage in all_pictures_array: + try: + string = allpictures[str(eachImage)] + except: + found_pictures_array.append(eachImage) + count = 0 + if len(found_pictures_array) > 0 : + self.updateUI("Loading Intelligence Model...") + rescanimagePrediction.loadModel() + for eachImage in found_pictures_array: + try: + count += 1 + self.updateUI("Processing " + str(count) + " of " + str(len(found_pictures_array))) + predictions, percentage_probabilities = rescanimagePrediction.predictImage(eachImage, + result_count=1) + for index in range(len(predictions)): + imageDictionary = {} + imageDictionary["path"] = str(eachImage) + imageDictionary["prediction"] = predictions[index] + + imageCategory = gallery_class[predictions[index]] + imageDictionary["category"] = imageCategory + + if (imageCategory == "animals"): + rescanpictures_animals_array.append(imageDictionary) + elif (imageCategory == "sea animals"): + rescanpictures_seaanimals_array.append(imageDictionary) + elif (imageCategory == "birds"): + rescanpictures_birds_array.append(imageDictionary) + elif (imageCategory == "objects"): + rescanpictures_objects_array.append(imageDictionary) + elif (imageCategory == "electronics"): + rescanpictures_electronics_array.append(imageDictionary) + elif (imageCategory == "dresses"): + rescanpictures_dresses_array.append(imageDictionary) + elif (imageCategory == "foods"): + rescanpictures_foods_array.append(imageDictionary) + elif (imageCategory == "plants"): + rescanpictures_plants_array.append(imageDictionary) + elif (imageCategory == "aircrafts"): + rescanpictures_aircrafts_array.append(imageDictionary) + elif (imageCategory == "places"): + rescanpictures_places_array.append(imageDictionary) + elif (imageCategory == "vehicles"): + rescanpictures_vehicles_array.append(imageDictionary) + elif (imageCategory == "people"): + rescanpictures_people_array.append(imageDictionary) + except: + continue + + + for eachPath in found_pictures_array: + allpictures[eachPath] = "" + + + if count > 0: + self.updateUI("Getting things Ready...") + with open(execution_path + "\\pictures.json", "w+") as picturesFile: + json.dump(pictures_class, picturesFile, indent=4, sort_keys=True, separators=(",", " : "), + ensure_ascii=True) + picturesFile.close() + + with open(execution_path + "\\pictures_monitor.json", "w+") as monitorFile: + json.dump(allpictures, monitorFile, indent=4, sort_keys=True, separators=(",", " : "), + ensure_ascii=True) + monitorFile.close() + + pictures_animals_array.clear() + pictures_seaanimals_array.clear() + pictures_birds_array.clear() + pictures_objects_array.clear() + pictures_electronics_array.clear() + pictures_dresses_array.clear() + pictures_foods_array.clear() + pictures_plants_array.clear() + pictures_aircrafts_array.clear() + pictures_places_array.clear() + pictures_vehicles_array.clear() + pictures_people_array.clear() + + self.updateFinalUI() + else: + self.updateFinalUI() + + + + + + + + + +# The below class is the code for button that initiates the computer scanning process +class ScanButton(Button): + def __init__(self, **kwargs): + super(ScanButton, self).__init__(**kwargs) + + def on_press(self): + scanning = ScanThread() + scanning.start() + mainLayout.add_widget(scanLayout) + +# The below class is the code for button that initiates the computer rescanning process +class ReScanButton(Button): + def __init__(self, galleryLayout, detailsLayout, **kwargs): + super(ReScanButton, self).__init__(**kwargs) + self.gallery_layout = galleryLayout + self.details_layout = detailsLayout + + def on_press(self): + rescanning = ReScanThread() + rescanning.start() + label1.text = "Re-scanning of system photos is \n" \ + "ongoing. Wait while it completes" + mainLayout.remove_widget(self.gallery_layout) + mainLayout.remove_widget(self.details_layout) + mainLayout.add_widget(scanLayout) + +# The below class is the code for button that initiates the "loadGallery()" function for aeach photo category +class LoadGalleryButton(Button): + def __init__(self, category_name, category_array, **kwargs): + super(LoadGalleryButton, self).__init__(**kwargs) + self.category_name = category_name + self.category_array = category_array + + def on_press(self): + loadGallery(self.category_name, self.category_array) + + # The below class is the code for button that removes the loaded photo category +class CloseGallery(Button): + def __init__(self, gallery_layout, gallery_action, **kwargs): + super(CloseGallery, self).__init__(**kwargs) + self.gallery_layout = gallery_layout + self.gallery_action = gallery_action + + def on_press(self): + mainLayout.remove_widget(self.gallery_layout) + mainLayout.remove_widget(self.gallery_action) + + # The below class is the code for button that shows an image in full view +class ViewImage(Button): + def __init__(self, imagePath, imageLabel, **kwargs): + super(ViewImage, self).__init__(**kwargs) + self.image_path = imagePath + self.image_label = imageLabel + + def on_press(self): + imageLayout = GridLayout() + imageLayout.size_hint = (1, None) + imageLayout.size = (Window.width, Window.height) + imageLayout.cols = 1 + with imageLayout.canvas.before: + Color(0, 1, 0, 1) + imageLayout.rect = Rectangle(size=Window.size, pos=imageLayout.pos) + + imageView = AsyncImage(size_hint_y = 6, size_hint_x = 1) + try: + imageView.source = self.image_path + imageLayout.add_widget(imageView) + except: + None + + imageLabel = Label(size_hint_y = 1) + imageLabel.text = self.image_label + imageLabel.font_size = 20 + imageLayout.add_widget(imageLabel) + + closeImage = CloseImage(imageLayout) + closeImage.text = " << Back " + closeImage.size_hint_y = 1 + closeImage.font_size = 20 + imageLayout.add_widget(closeImage) + + mainLayout.add_widget(imageLayout) +# The below class is the code for button that close the full view of an image +class CloseImage(Button): + def __init__(self, imageLayout, **kwargs): + super(CloseImage, self).__init__(**kwargs) + self.image_layout = imageLayout + + def on_press(self): + mainLayout.remove_widget(self.image_layout) + + +# Below is the code that shows the main layout when a user open the application for the first time. +welcomeLayout = GridLayout() +welcomeLayout.size_hint = (1, None) +welcomeLayout.size = (Window.width, Window.height) +welcomeLayout.cols = 1 +mainLayout.add_widget(welcomeLayout) + +logo = AsyncImage() +logo.size_hint = (1,3) +try: + logo.source = execution_path + "\\logo.png" +except: + None +welcomeLayout.add_widget(logo) + +intro = Label() +intro.font_size = 12 +intro.text = "Welcome to IntelliP, your intelligent picture Gallery!" +welcomeLayout.add_widget(intro) + +welcomeActionLayout = GridLayout() +welcomeActionLayout.cols = 2 +welcomeActionLayout.spacing = 10 +welcomeActionLayout.size_hint = (1, 2) +welcomeLayout.add_widget(welcomeActionLayout) + +scanButton = ScanButton() +scanButton.size_hint = (1, None) +scanButton.text = "Scan Photos" +scanButton.font_size = 20 +welcomeActionLayout.add_widget(scanButton) + +aboutButton = AboutButton() +aboutButton.size_hint = (1, None) +aboutButton.text = "About" +aboutButton.font_size = 20 +welcomeActionLayout.add_widget(aboutButton) + +copyright = Label() +copyright.font_size = 15 +copyright.text = "(c) Moses & John Olafenwa" +welcomeLayout.add_widget(copyright) + + +# Below is the code that defines a custom object class for storing the path, prediction and percentage +# probability of the image +class ImageObject(): + def __init__(self, label, percentage, file_path): + self.prediction = label + self.percentage = percentage + self.filePath = file_path + + def getLabel(self): + return self.prediction + def getPercentage(self): + return self.percentage + def getPath(self): + return self.filePath + + +# Below is the default code that runs each time the application is opened. It will only +# execute when an existing scan had been made before. This code when it runs, +# will obtain all picture categories with pictures in them and show them +# in the Application +if(os.path.exists(execution_path + "\\pictures.json")): + with open(execution_path + "\\pictures.json") as inputFile: + json_data = json.load(inputFile) + + animals_data = json_data["animals"] + for eachObject in animals_data: + imageDictionary = {} + imageDictionary["path"] = eachObject["path"] + imageDictionary["prediction"] = eachObject["prediction"] + imageDictionary["category"] = "animals" + pictures_animals_array.append(imageDictionary) + + seaanimals_data = json_data["seaanimals"] + for eachObject in seaanimals_data: + imageDictionary = {} + imageDictionary["path"] = eachObject["path"] + imageDictionary["prediction"] = eachObject["prediction"] + imageDictionary["category"] = "seaanimals" + pictures_seaanimals_array.append(imageDictionary) + + birds_data = json_data["birds"] + for eachObject in birds_data: + imageDictionary = {} + imageDictionary["path"] = eachObject["path"] + imageDictionary["prediction"] = eachObject["prediction"] + imageDictionary["category"] = "birds" + pictures_birds_array.append(imageDictionary) + + objects_data = json_data["objects"] + for eachObject in objects_data: + imageDictionary = {} + imageDictionary["path"] = eachObject["path"] + imageDictionary["prediction"] = eachObject["prediction"] + imageDictionary["category"] = "objects" + pictures_objects_array.append(imageDictionary) + + electronics_data = json_data["electronics"] + for eachObject in electronics_data: + imageDictionary = {} + imageDictionary["path"] = eachObject["path"] + imageDictionary["prediction"] = eachObject["prediction"] + imageDictionary["category"] = "electronics" + pictures_electronics_array.append(imageDictionary) + + dresses_data = json_data["dresses"] + for eachObject in dresses_data: + imageDictionary = {} + imageDictionary["path"] = eachObject["path"] + imageDictionary["prediction"] = eachObject["prediction"] + imageDictionary["category"] = "dresses" + pictures_dresses_array.append(imageDictionary) + + foods_data = json_data["foods"] + for eachObject in foods_data: + imageDictionary = {} + imageDictionary["path"] = eachObject["path"] + imageDictionary["prediction"] = eachObject["prediction"] + imageDictionary["category"] = "foods" + pictures_foods_array.append(imageDictionary) + + plants_data = json_data["plants"] + for eachObject in plants_data: + imageDictionary = {} + imageDictionary["path"] = eachObject["path"] + imageDictionary["prediction"] = eachObject["prediction"] + imageDictionary["category"] = "plants" + pictures_plants_array.append(imageDictionary) + + aircrafts_data = json_data["aircrafts"] + for eachObject in aircrafts_data: + imageDictionary = {} + imageDictionary["path"] = eachObject["path"] + imageDictionary["prediction"] = eachObject["prediction"] + imageDictionary["category"] = "aircrafts" + pictures_aircrafts_array.append(imageDictionary) + + places_data = json_data["places"] + for eachObject in places_data: + imageDictionary = {} + imageDictionary["path"] = eachObject["path"] + imageDictionary["prediction"] = eachObject["prediction"] + imageDictionary["category"] = "places" + pictures_places_array.append(imageDictionary) + + vehicles_data = json_data["vehicles"] + for eachObject in vehicles_data: + imageDictionary = {} + imageDictionary["path"] = eachObject["path"] + imageDictionary["prediction"] = eachObject["prediction"] + imageDictionary["category"] = "vehicles" + pictures_vehicles_array.append(imageDictionary) + + people_data = json_data["people"] + for eachObject in people_data: + imageDictionary = {} + imageDictionary["path"] = eachObject["path"] + imageDictionary["prediction"] = eachObject["prediction"] + imageDictionary["category"] = "people" + pictures_people_array.append(imageDictionary) + + if (len(pictures_animals_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_animals_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + None + + categoryLabel = Label() + categoryLabel.text = " >>> Animals" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Animals", pictures_animals_array) + loadButton.text = "View Animals" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + galleryGrid.add_widget(categoryGrid) + + if (len(pictures_seaanimals_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_seaanimals_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + None + + categoryLabel = Label() + categoryLabel.text = " >>> Sea Animals" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Sea Animals", pictures_seaanimals_array) + loadButton.text = "View Sea Animals" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + galleryGrid.add_widget(categoryGrid) + + + ## Adding the Categories to UI + + if (len(pictures_birds_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_birds_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + None + + categoryLabel = Label() + categoryLabel.text = " >>> Birds" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Birds", pictures_birds_array) + loadButton.text = "View Birds" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + galleryGrid.add_widget(categoryGrid) + + if (len(pictures_objects_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_objects_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + None + + categoryLabel = Label() + categoryLabel.text = " >>> Objects" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Objects", pictures_objects_array) + loadButton.text = "View Objects" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + galleryGrid.add_widget(categoryGrid) + + if (len(pictures_electronics_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_electronics_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + None + + categoryLabel = Label() + categoryLabel.text = " >>> Electronics" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Electronics", pictures_electronics_array) + loadButton.text = "View Electronics" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + galleryGrid.add_widget(categoryGrid) + + if (len(pictures_dresses_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_dresses_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + None + + categoryLabel = Label() + categoryLabel.text = " >>> Dresses" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Dresses", pictures_dresses_array) + loadButton.text = "View Dresses" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + galleryGrid.add_widget(categoryGrid) + + if (len(pictures_foods_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_foods_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + None + + categoryLabel = Label() + categoryLabel.text = " >>> Foods" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Foods", pictures_foods_array) + loadButton.text = "View Foods" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + galleryGrid.add_widget(categoryGrid) + + if (len(pictures_plants_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_plants_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + None + + categoryLabel = Label() + categoryLabel.text = " >>> Plants" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Plants", pictures_plants_array) + loadButton.text = "Plants" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + galleryGrid.add_widget(categoryGrid) + + if (len(pictures_aircrafts_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_aircrafts_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + None + + categoryLabel = Label() + categoryLabel.text = " >>> Aircrafts" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Aircrafts", pictures_aircrafts_array) + loadButton.text = "View Aircrafts" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + galleryGrid.add_widget(categoryGrid) + + if (len(pictures_places_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_places_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + None + + categoryLabel = Label() + categoryLabel.text = " >>> Places" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Places", pictures_places_array) + loadButton.text = "View Places" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + galleryGrid.add_widget(categoryGrid) + + if (len(pictures_vehicles_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_vehicles_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + None + + categoryLabel = Label() + categoryLabel.text = " >>> Vehicles" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> Vehicles", pictures_vehicles_array) + loadButton.text = "View Vehicles" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + galleryGrid.add_widget(categoryGrid) + + if (len(pictures_people_array) > 0): + categoryGrid = GridLayout(size_hint_y=None, height=400) + categoryGrid.cols = 1 + + categoryImage = AsyncImage(size_hint_y=None, height=300) + try: + categoryImage.source = pictures_people_array[0]["path"] + categoryGrid.add_widget(categoryImage) + except: + None + + categoryLabel = Label() + categoryLabel.text = " >>> People" + categoryLabel.font_size = 15 + categoryGrid.add_widget(categoryLabel) + + loadButton = LoadGalleryButton(" >> People", pictures_people_array) + loadButton.text = "View People" + loadButton.font_size = 15 + categoryGrid.add_widget(loadButton) + + galleryGrid.add_widget(categoryGrid) + + dummyGridObject = Label() + dummyGridObject.size_hint_y = None + dummyGridObject.height = "100" + dummyGridObject.text = " . \n" \ + " . \n" \ + " . \n" + galleryGrid.add_widget(dummyGridObject) + + galleryScroll.add_widget(galleryGrid) + mainLayout.add_widget(galleryScroll) + + + + detailsGrid = GridLayout() + detailsGrid.cols = 4 + detailsGrid.size_hint = (1, None) + + + dummy1 = Label() + dummy1.size_hint = (1, None) + detailsGrid.add_widget(dummy1) + + aboutbutton = AboutButton() + aboutbutton.text = "About" + aboutbutton.font_size = 15 + aboutbutton.size_hint = (2, None) + aboutbutton.height = 30 + detailsGrid.add_widget(aboutbutton) + + rescanbutton = ReScanButton(galleryScroll, detailsGrid) + rescanbutton.text = "Re-Scan Photos" + rescanbutton.font_size = 15 + rescanbutton.size_hint = (2, None) + rescanbutton.height = 30 + detailsGrid.add_widget(rescanbutton) + + dummy2 = Label() + dummy2.size_hint = (1, None) + detailsGrid.add_widget(dummy2) + + mainLayout.add_widget(detailsGrid) + + + + + + + + + +# Below is the function that executes when you click to load a category. +# It will load all the pictures in the category and show it. + +def loadGallery(category_name, category_array): + + if gallerySteps > 2: + global gallerySteps + gallerySteps -= (gallerySteps - 1) + + actionGrid = GridLayout() + + parentScroll = Scroller(actionGrid) + parentScroll.bar_width = 20 + parentScroll.bar_inactive_color = [0.3, 0.9, 0, 5, 0.9] + with parentScroll.canvas.before: + Color(0, 1, 0, 1) + parentScroll.rect = Rectangle(size=Window.size, pos=parentScroll.pos) + + containerGrid = GridLayout(spacing=10, size_hint_y=None) + containerGrid.cols = 2 + containerGrid.bind(minimum_height=containerGrid.setter('height')) + + + pictures_object_array.clear() + + for eachObject in category_array: + imageObject = ImageObject(eachObject["prediction"], "", + eachObject["path"]) + pictures_object_array.append(imageObject) + + count = 0 + for eachImage in pictures_object_array: + + try: + count += 1 + imageGrid = GridLayout(size_hint_y=None, height=400) + imageGrid.cols = 1 + + image1 = AsyncImage(size_hint_y=None, height=300) + try: + image1.source = eachImage.getPath() + imageGrid.add_widget(image1) + except: + None + + label1 = Label() + label1.text = eachImage.getLabel() + " : " + eachImage.getPercentage() + imageGrid.add_widget(label1) + + button1 = ViewImage(eachImage.getPath(), eachImage.getLabel()) + button1.text = " View Image " + button1.font_size = 20 + imageGrid.add_widget(button1) + + containerGrid.add_widget(imageGrid) + + if (count == 10): + break + + except: + continue + + + actionGrid.cols = 2 + actionGrid.size_hint = (1, None) + + closeButton = CloseGallery(parentScroll, actionGrid ) + closeButton.text = " << " + closeButton.font_size = 30 + closeButton.size_hint = (1, None) + actionGrid.add_widget(closeButton) + + pageLabel = Label() + pageLabel.text = "1-" + str(count) + " of " + str(len(pictures_object_array)) + pageLabel.font_size = 20 + pageLabel.size_hint = (11, None) + actionGrid.add_widget(pageLabel) + + + + + + parentScroll.add_widget(containerGrid) + mainLayout.add_widget(parentScroll) + mainLayout.add_widget(actionGrid) + + + + + + + +# The function below will load previous page of at most 10 photos when the user scroll +# to the top of the category view. It works by removing the existing photo category +# and add a new one containing new pictures. +def loadPrevious(): + + + if gallerySteps != 1 : + global gallerySteps + gallerySteps -= 2 + startingPoint = gallerySteps * 10 + endingPoint = startingPoint + 10 + + + actionGrid = GridLayout() + + newGalleryScroll = Scroller(actionGrid) + newGalleryScroll.bar_width = 20 + newGalleryScroll.bar_inactive_color = [0.3, 0.9, 0, 5, 0.9] + with newGalleryScroll.canvas.before: + Color(0, 1, 0, 1) + newGalleryScroll.rect = Rectangle(size=Window.size, pos=newGalleryScroll.pos) + + newGalleryGrid = GridLayout(spacing=10, size_hint_y=None) + newGalleryGrid.cols = 2 + newGalleryGrid.bind(minimum_height=newGalleryGrid.setter('height')) + newGalleryScroll.add_widget(newGalleryGrid) + mainLayout.add_widget(newGalleryScroll) + + + for aa in range(10): + + try: + + eachImage = pictures_object_array[startingPoint + aa] + + imageGrid = GridLayout(size_hint_y=None, height=400) + imageGrid.cols = 1 + + image1 = AsyncImage(size_hint_y=None, height=300) + try: + image1.source = eachImage.getPath() + imageGrid.add_widget(image1) + except: + None + + label1 = Label() + label1.text = eachImage.getLabel() + " : " + eachImage.getPercentage() + imageGrid.add_widget(label1) + + button1 = ViewImage(eachImage.getPath(), eachImage.getLabel()) + button1.text = " View Image " + button1.font_size = 20 + imageGrid.add_widget(button1) + + newGalleryGrid.add_widget(imageGrid) + + + + except: + continue + + + actionGrid.cols = 2 + actionGrid.size_hint = (1, None) + + closeButton = CloseGallery(newGalleryScroll, actionGrid) + closeButton.text = " << " + closeButton.font_size = 30 + closeButton.size_hint = (1, None) + actionGrid.add_widget(closeButton) + + pageLabel = Label() + pageLabel.text = str(startingPoint + 1) + "-" + str(endingPoint) + " of " + str(len(pictures_object_array)) + pageLabel.font_size = 20 + pageLabel.size_hint = (11, None) + actionGrid.add_widget(pageLabel) + mainLayout.add_widget(actionGrid) + + global gallerySteps + gallerySteps += 1 + + return True + else: + return False + + + +# The function below will load next page of at most 10 photos when the user scroll +# to the bottom of the category view. It works by removing the existing photo category +# and add a new one containing new pictures. +def loadNext(): + startingPoint = gallerySteps * 10 + endingPoint = startingPoint + 10 + + if(len(pictures_object_array) - startingPoint) > 0 and (len(pictures_object_array) - startingPoint) < 10: + + endingPoint = len(pictures_object_array) + + actionGrid = GridLayout() + + newGalleryScroll = Scroller(actionGrid) + newGalleryScroll.bar_width = 20 + newGalleryScroll.bar_inactive_color = [0.3, 0.9, 0, 5, 0.9] + with newGalleryScroll.canvas.before: + Color(0, 1, 0, 1) + newGalleryScroll.rect = Rectangle(size=Window.size, pos=newGalleryScroll.pos) + + newGalleryGrid = GridLayout(cols=2, spacing=10, size_hint_y=None) + newGalleryGrid.cols = 2 + newGalleryGrid.bind(minimum_height=newGalleryGrid.setter('height')) + newGalleryScroll.add_widget(newGalleryGrid) + mainLayout.add_widget(newGalleryScroll) + + + + for aa in range(endingPoint - startingPoint): + + try: + + eachImage = pictures_object_array[startingPoint + aa] + + imageGrid = GridLayout(size_hint_y=None, height=400) + imageGrid.cols = 1 + + image1 = AsyncImage(size_hint_y=None, height=300) + try: + image1.source = eachImage.getPath() + imageGrid.add_widget(image1) + except: + None + + label1 = Label() + label1.text = eachImage.getLabel() + imageGrid.add_widget(label1) + + button1 = ViewImage(eachImage.getPath(), eachImage.getLabel()) + button1.text = " View Image " + button1.font_size = 20 + imageGrid.add_widget(button1) + + newGalleryGrid.add_widget(imageGrid) + + + + except: + continue + + + actionGrid.cols = 2 + actionGrid.size_hint = (1, None) + + closeButton = CloseGallery(newGalleryScroll, actionGrid) + closeButton.text = " << " + closeButton.font_size = 30 + closeButton.size_hint = (1, None) + actionGrid.add_widget(closeButton) + + pageLabel = Label() + pageLabel.text = str(startingPoint + 1) + "-" + str(endingPoint) + " of " + str(len(pictures_object_array)) + pageLabel.font_size = 20 + pageLabel.size_hint = (11, None) + actionGrid.add_widget(pageLabel) + mainLayout.add_widget(actionGrid) + + global gallerySteps + gallerySteps += 1 + + return True + + + + + elif(len(pictures_object_array) - startingPoint) > 0 and (len(pictures_object_array) - startingPoint) >= 10: + + actionGrid = GridLayout() + + newGalleryScroll = Scroller(actionGrid) + newGalleryScroll.bar_width = 20 + newGalleryScroll.bar_inactive_color = [0.3, 0.9, 0, 5, 0.9] + with newGalleryScroll.canvas.before: + Color(0, 1, 0, 1) + newGalleryScroll.rect = Rectangle(size=Window.size, pos=newGalleryScroll.pos) + + newGalleryGrid = GridLayout(cols=2, spacing=10, size_hint_y=None) + newGalleryGrid.cols = 2 + newGalleryGrid.bind(minimum_height=newGalleryGrid.setter('height')) + newGalleryScroll.add_widget(newGalleryGrid) + mainLayout.add_widget(newGalleryScroll) + + + + + + for aa in range(10): + + try: + + eachImage = pictures_object_array[startingPoint + aa] + + imageGrid = GridLayout(size_hint_y=None, height=400) + imageGrid.cols = 1 + + + image1 = AsyncImage(size_hint_y=None, height=300) + try: + image1.source = eachImage.getPath() + imageGrid.add_widget(image1) + except: + None + + label1 = Label() + label1.text = eachImage.getLabel() + imageGrid.add_widget(label1) + + button1 = ViewImage(eachImage.getPath(), eachImage.getLabel()) + button1.text = " View Image " + button1.font_size = 20 + imageGrid.add_widget(button1) + + newGalleryGrid.add_widget(imageGrid) + + + + except: + continue + + + actionGrid.cols = 2 + actionGrid.size_hint = (1, None) + + closeButton = CloseGallery(newGalleryScroll, actionGrid) + closeButton.text = " << " + closeButton.font_size = 30 + closeButton.size_hint = (1, None) + actionGrid.add_widget(closeButton) + + pageLabel = Label() + pageLabel.text = str(startingPoint + 1) + "-" + str(endingPoint) + " of " + str(len(pictures_object_array)) + pageLabel.font_size = 20 + pageLabel.size_hint = (11, None) + actionGrid.add_widget(pageLabel) + mainLayout.add_widget(actionGrid) + + global gallerySteps + gallerySteps += 1 + + return True + else: + return False + + + +# The code below initiates the Application window +runTouchApp(mainLayout) + + + + + + diff --git a/background.jpg b/background.jpg new file mode 100644 index 0000000..79bb27f Binary files /dev/null and b/background.jpg differ diff --git a/custom classes.txt b/custom classes.txt new file mode 100644 index 0000000..700fee3 --- /dev/null +++ b/custom classes.txt @@ -0,0 +1,12 @@ +animals +sea animals +birds +objects +electronics +dresses +foods +plants +aircrafts +places +vehicles +people \ No newline at end of file diff --git a/five.jpg b/five.jpg new file mode 100644 index 0000000..35d8c78 Binary files /dev/null and b/five.jpg differ diff --git a/four.jpg b/four.jpg new file mode 100644 index 0000000..d93cd29 Binary files /dev/null and b/four.jpg differ diff --git a/gallery_class.json b/gallery_class.json new file mode 100644 index 0000000..41d5e96 --- /dev/null +++ b/gallery_class.json @@ -0,0 +1,1000 @@ +{ + "Afghan_hound" : "animals", + "African_chameleon" : "animals", + "African_crocodile" : "animals", + "African_elephant" : "animals", + "African_grey" : "animals", + "African_hunting_dog" : "animals", + "Airedale" : "animals", + "American_Staffordshire_terrier" : "animals", + "American_alligator" : "animals", + "American_black_bear" : "animals", + "American_chameleon" : "animals", + "American_coot" : "birds", + "American_egret" : "birds", + "American_lobster" : "sea animals", + "Angora" : "animals", + "Appenzeller" : "animals", + "Arabian_camel" : "animals", + "Arctic_fox" : "animals", + "Australian_terrier" : "animals", + "Band_Aid" : "objects", + "Bedlington_terrier" : "animals", + "Bernese_mountain_dog" : "animals", + "Blenheim_spaniel" : "animals", + "Border_collie" : "animals", + "Border_terrier" : "animals", + "Boston_bull" : "animals", + "Bouvier_des_Flandres" : "animals", + "Brabancon_griffon" : "animals", + "Brittany_spaniel" : "category", + "CD_player" : "electronics", + "Cardigan" : "dresses", + "Chesapeake_Bay_retriever" : "animals", + "Chihuahua" : "animals", + "Christmas_stocking" : "dresses", + "Crock_Pot" : "objects", + "Dandie_Dinmont" : "animals", + "Doberman" : "animals", + "Dungeness_crab" : "sea animals", + "Dutch_oven" : "objects", + "Egyptian_cat" : "animals", + "English_foxhound" : "animals", + "English_setter" : "animals", + "English_springer" : "animals", + "EntleBucher" : "animals", + "Eskimo_dog" : "animals", + "European_fire_salamander" : "animals", + "European_gallinule" : "animals", + "French_bulldog" : "animals", + "French_horn" : "objects", + "French_loaf" : "foods", + "German_shepherd" : "animals", + "German_short-haired_pointer" : "animals", + "Gila_monster" : "animals", + "Gordon_setter" : "animals", + "Granny_Smith" : "foods", + "Great_Dane" : "animals", + "Great_Pyrenees" : "foods", + "Greater_Swiss_Mountain_dog" : "animals", + "Ibizan_hound" : "animals", + "Indian_cobra" : "animals", + "Indian_elephant" : "animals", + "Irish_setter" : "animals", + "Irish_terrier" : "animals", + "Irish_water_spaniel" : "animals", + "Irish_wolfhound" : "animals", + "Italian_greyhound" : "animals", + "Japanese_spaniel" : "animals", + "Kerry_blue_terrier" : "animals", + "Komodo_dragon" : "animals", + "Labrador_retriever" : "animals", + "Lakeland_terrier" : "animals", + "Leonberg" : "animals", + "Lhasa" : "objects", + "Loafer" : "dresses", + "Madagascar_cat" : "animals", + "Maltese_dog" : "animals", + "Mexican_hairless" : "animals", + "Model_T" : "objects", + "Newfoundland" : "animals", + "Norfolk_terrier" : "animals", + "Norwegian_elkhound" : "animals", + "Norwich_terrier" : "animals", + "Old_English_sheepdog" : "animals", + "Pekinese" : "animals", + "Pembroke" : "objects", + "Persian_cat" : "animals", + "Petri_dish" : "objects", + "Polaroid_camera" : "electronics", + "Pomeranian" : "animals", + "Rhodesian_ridgeback" : "animals", + "Rottweiler" : "animals", + "Saint_Bernard" : "animals", + "Saluki" : "animals", + "Samoyed" : "animals", + "Scotch_terrier" : "animals", + "Scottish_deerhound" : "animals", + "Sealyham_terrier" : "animals", + "Shetland_sheepdog" : "animals", + "Shih-Tzu" : "animals", + "Siamese_cat" : "animals", + "Siberian_husky" : "animals", + "Staffordshire_bullterrier" : "animals", + "Sussex_spaniel" : "animals", + "Tibetan_mastiff" : "animals", + "Tibetan_terrier" : "animals", + "Walker_hound" : "animals", + "Weimaraner" : "animals", + "Welsh_springer_spaniel" : "animals", + "West_Highland_white_terrier" : "animals", + "Windsor_tie" : "objects", + "Yorkshire_terrier" : "animals", + "abacus" : "objects", + "abaya" : "dresses", + "academic_gown" : "dresses", + "accordion" : "objects", + "acorn" : "foods", + "acorn_squash" : "foods", + "acoustic_guitar" : "objects", + "admiral" : "plants", + "affenpinscher" : "animals", + "agama" : "animals", + "agaric" : "plants", + "aircraft_carrier" : "aircrafts", + "airliner" : "aircrafts", + "airship" : "aircrafts", + "albatross" : "animals", + "alligator_lizard" : "animals", + "alp" : "places", + "altar" : "places", + "ambulance" : "vehicles", + "amphibian" : "animals", + "analog_clock" : "objects", + "anemone_fish" : "sea animals", + "ant" : "animals", + "apiary" : "objects", + "apron" : "dresses", + "armadillo" : "animals", + "artichoke" : "plants", + "ashcan" : "objects", + "assault_rifle" : "objects", + "axolotl" : "animals", + "baboon" : "animals", + "backpack" : "objects", + "badger" : "animals", + "bagel" : "foods", + "bakery" : "places", + "balance_beam" : "objects", + "bald_eagle" : "birds", + "balloon" : "objects", + "ballplayer" : "people", + "ballpoint" : "objects", + "banana" : "foods", + "banded_gecko" : "animals", + "banjo" : "objects", + "bannister" : "objects", + "barbell" : "objects", + "barber_chair" : "objects", + "barbershop" : "places", + "barn" : "objects", + "barn_spider" : "animals", + "barometer" : "objects", + "barracouta" : "sea animals", + "barrel" : "objects", + "barrow" : "objects", + "baseball" : "objects", + "basenji" : "animals", + "basketball" : "objects", + "basset" : "objects", + "bassinet" : "objects", + "bassoon" : "objects", + "bath_towel" : "objects", + "bathing_cap" : "dresses", + "bathtub" : "objects", + "beach_wagon" : "vehicles", + "beacon" : "objects", + "beagle" : "animals", + "beaker" : "objects", + "bearskin" : "dresses", + "beaver" : "sea animals", + "bee" : "animals", + "bee_eater" : "animals", + "beer_bottle" : "objects", + "beer_glass" : "objects", + "bell_cote" : "objects", + "bell_pepper" : "objects", + "bib" : "dresses", + "bicycle-built-for-two" : "vehicles", + "bighorn" : "objects", + "bikini" : "dresses", + "binder" : "objects", + "binoculars" : "objects", + "birdhouse" : "places", + "bison" : "animals", + "bittern" : "birds", + "black-and-tan_coonhound" : "animals", + "black-footed_ferret" : "animals", + "black_and_gold_garden_spider" : "animals", + "black_grouse" : "brids", + "black_stork" : "birds", + "black_swan" : "birds", + "black_widow" : "animals", + "bloodhound" : "animals", + "bluetick" : "animals", + "boa_constrictor" : "animals", + "boathouse" : "places", + "bobsled" : "vehicles", + "bolete" : "objects", + "bolo_tie" : "dresses", + "bonnet" : "dresses", + "book_jacket" : "dresses", + "bookcase" : "objects", + "bookshop" : "places", + "borzoi" : "dresses", + "bottlecap" : "objects", + "bow" : "objects", + "bow_tie" : "dresses", + "box_turtle" : "animals", + "boxer" : "people", + "brain_coral" : "plants", + "brambling" : "birds", + "brass" : "objects", + "brassiere" : "dresses", + "breakwater" : "objects", + "breastplate" : "objects", + "briard" : "animals", + "broccoli" : "plants", + "broom" : "objects", + "brown_bear" : "animals", + "bubble" : "objects", + "bucket" : "objects", + "buckeye" : "plants", + "buckle" : "objects", + "bulbul" : "birds", + "bull_mastiff" : "animals", + "bullet_train" : "vehicles", + "bulletproof_vest" : "objects", + "bullfrog" : "animals", + "burrito" : "foods", + "bustard" : "birds", + "butcher_shop" : "places", + "butternut_squash" : "plants", + "cab" : "vehicles", + "cabbage_butterfly" : "animals", + "cairn" : "objects", + "caldron" : "objects", + "can_opener" : "objects", + "candle" : "objects", + "cannon" : "objects", + "canoe" : "vehicles", + "capuchin" : "animals", + "car_mirror" : "objects", + "car_wheel" : "objects", + "carbonara" : "objects", + "cardigan" : "dresses", + "cardoon" : "plants", + "carousel" : "objects", + "carpenter's_kit" : "objects", + "carton" : "objects", + "cash_machine" : "electronics", + "cassette" : "electronics", + "cassette_player" : "electronics", + "castle" : "places", + "catamaran" : "vehicles", + "cauliflower" : "plants", + "cello" : "objects", + "cellular_telephone" : "electronics", + "centipede" : "animals", + "chain" : "objects", + "chain_mail" : "objects", + "chain_saw" : "objects", + "chainlink_fence" : "objects", + "chambered_nautilus" : "sea animals", + "cheeseburger" : "foods", + "cheetah" : "animals", + "chest" : "objects", + "chickadee" : "birds", + "chiffonier" : "objects", + "chime" : "objects", + "chimpanzee" : "animals", + "china_cabinet" : "objects", + "chiton" : "sea animals", + "chocolate_sauce" : "foods", + "chow" : "foods", + "church" : "places", + "cicada" : "animals", + "cinema" : "places", + "cleaver" : "objects", + "cliff" : "places", + "cliff_dwelling" : "places", + "cloak" : "dresses", + "clog" : "dresses", + "clumber" : "dresses", + "cock" : "animals", + "cocker_spaniel" : "animals", + "cockroach" : "animals", + "cocktail_shaker" : "objects", + "coffee_mug" : "objects", + "coffeepot" : "objects", + "coho" : "sea animals", + "coil" : "objects", + "collie" : "animals", + "colobus" : "animals", + "combination_lock" : "objects", + "comic_book" : "objects", + "common_iguana" : "animals", + "common_newt" : "animals", + "computer_keyboard" : "electronics", + "conch" : "animals", + "confectionery" : "places", + "consomme" : "foods", + "container_ship" : "vehicles", + "convertible" : "vehicles", + "coral_fungus" : "plants", + "coral_reef" : "plants", + "corkscrew" : "objects", + "corn" : "foods", + "cornet" : "objects", + "coucal" : "objects", + "cougar" : "animals", + "cowboy_boot" : "dresses", + "cowboy_hat" : "dresses", + "coyote" : "animals", + "cradle" : "places", + "crane" : "vehicles", + "crash_helmet" : "objects", + "crate" : "objects", + "crayfish" : "sea animals", + "crib" : "objects", + "cricket" : "animals", + "croquet_ball" : "objects", + "crossword_puzzle" : "objects", + "crutch" : "objects", + "cucumber" : "foods", + "cuirass" : "objects", + "cup" : "objects", + "curly-coated_retriever" : "objects", + "custard_apple" : "foods", + "daisy" : "plants", + "dalmatian" : "animals", + "dam" : "places", + "damselfly" : "animals", + "desk" : "objects", + "desktop_computer" : "electronics", + "dhole" : "animals", + "dial_telephone" : "electronics", + "diamondback" : "animals", + "diaper" : "objects", + "digital_clock" : "objects", + "digital_watch" : "objects", + "dingo" : "animals", + "dining_table" : "objects", + "dishrag" : "objects", + "dishwasher" : "objects", + "disk_brake" : "objects", + "dock" : "objects", + "dogsled" : "vehicles", + "dome" : "objects", + "doormat" : "objects", + "dough" : "foods", + "dowitcher" : "objects", + "dragonfly" : "animals", + "drake" : "animals", + "drilling_platform" : "places", + "drum" : "objects", + "drumstick" : "objects", + "dugong" : "sea animals", + "dumbbell" : "objects", + "dung_beetle" : "animals", + "ear" : "objects", + "earthstar" : "plants", + "echidna" : "animals", + "eel" : "animals", + "eft" : "animals", + "eggnog" : "foods", + "electric_fan" : "electronics", + "electric_guitar" : "electronics", + "electric_locomotive" : "electronics", + "electric_ray" : "electronics", + "entertainment_center" : "places", + "envelope" : "objects", + "espresso" : "foods", + "espresso_maker" : "electronics", + "face_powder" : "objects", + "feather_boa" : "animals", + "fiddler_crab" : "animals", + "fig" : "plants", + "file" : "objects", + "fire_engine" : "objects", + "fire_screen" : "objects", + "fireboat" : "vehicles", + "flagpole" : "objects", + "flamingo" : "animals", + "flat-coated_retriever" : "objects", + "flatworm" : "animals", + "flute" : "objects", + "fly" : "animals", + "folding_chair" : "objects", + "football_helmet" : "objects", + "forklift" : "vehicles", + "fountain" : "places", + "fountain_pen" : "objects", + "four-poster" : "objects", + "fox_squirrel" : "animals", + "freight_car" : "electronics", + "frilled_lizard" : "animals", + "frying_pan" : "objects", + "fur_coat" : "dresses", + "gar" : "sea animals", + "garbage_truck" : "electronics", + "garden_spider" : "animals", + "garter_snake" : "animals", + "gas_pump" : "objects", + "gasmask" : "objects", + "gazelle" : "animals", + "geyser" : "places", + "giant_panda" : "animals", + "giant_schnauzer" : "animals", + "gibbon" : "animals", + "go-kart" : "vehicles", + "goblet" : "objects", + "golden_retriever" : "objects", + "goldfinch" : "birds", + "goldfish" : "sea animals", + "golf_ball" : "objects", + "golfcart" : "objects", + "gondola" : "vehicles", + "gong" : "objects", + "goose" : "animals", + "gorilla" : "animals", + "gown" : "dresses", + "grand_piano" : "electronics", + "grasshopper" : "animals", + "great_grey_owl" : "birds", + "great_white_shark" : "sea animals", + "green_lizard" : "animals", + "green_mamba" : "animals", + "green_snake" : "animals", + "greenhouse" : "places", + "grey_fox" : "animals", + "grey_whale" : "sea animals", + "grille" : "objects", + "grocery_store" : "places", + "groenendael" : "objects", + "groom" : "people", + "ground_beetle" : "animals", + "guacamole" : "objects", + "guenon" : "animals", + "guillotine" : "objects", + "guinea_pig" : "animals", + "gyromitra" : "objects", + "hair_slide" : "objects", + "hair_spray" : "objects", + "half_track" : "objects", + "hammer" : "objects", + "hammerhead" : "birds", + "hamper" : "objects", + "hamster" : "animals", + "hand-held_computer" : "electronics", + "hand_blower" : "objects", + "handkerchief" : "objects", + "hard_disc" : "electronics", + "hare" : "animals", + "harmonica" : "objects", + "harp" : "objects", + "hartebeest" : "animals", + "harvester" : "vehicles", + "harvestman" : "people", + "hatchet" : "objects", + "hay" : "objects", + "head_cabbage" : "objects", + "hen" : "animals", + "hen-of-the-woods" : "places", + "hermit_crab" : "animals", + "hip" : "places", + "hippopotamus" : "animals", + "hog" : "animals", + "hognose_snake" : "animals", + "holster" : "objects", + "home_theater" : "electronics", + "honeycomb" : "objects", + "hook" : "objects", + "hoopskirt" : "dresses", + "horizontal_bar" : "objects", + "hornbill" : "birds", + "horned_viper" : "animals", + "horse_cart" : "vehicles", + "hot_pot" : "objects", + "hotdog" : "foods", + "hourglass" : "objects", + "house_finch" : "birds", + "howler_monkey" : "animals", + "hummingbird" : "birds", + "hyena" : "animals", + "iPod" : "objects", + "ibex" : "animals", + "ice_bear" : "animals", + "ice_cream" : "foods", + "ice_lolly" : "foods", + "impala" : "animals", + "indigo_bunting" : "birds", + "indri" : "animals", + "iron" : "objects", + "isopod" : "sea animals", + "jacamar" : "birds", + "jack-o'-lantern" : "objects", + "jackfruit" : "plants", + "jaguar" : "animals", + "jay" : "birds", + "jean" : "dresses", + "jeep" : "vehicles", + "jellyfish" : "sea animals", + "jersey" : "dresses", + "jigsaw_puzzle" : "objects", + "jinrikisha" : "objects", + "joystick" : "objects", + "junco" : "birds", + "keeshond" : "animals", + "kelpie" : "objects", + "killer_whale" : "animals", + "kimono" : "dresses", + "king_crab" : "animals", + "king_penguin" : "animals", + "king_snake" : "animals", + "kit_fox" : "animals", + "kite" : "objects", + "knee_pad" : "objects", + "knot" : "objects", + "koala" : "animals", + "komondor" : "objects", + "kuvasz" : "objects", + "lab_coat" : "dresses", + "lacewing" : "animals", + "ladle" : "objects", + "ladybug" : "animals", + "lakeside" : "places", + "lampshade" : "objects", + "langur" : "animals", + "laptop" : "electronics", + "lawn_mower" : "electronics", + "leaf_beetle" : "animals", + "leafhopper" : "animals", + "leatherback_turtle" : "animals", + "lemon" : "plants", + "lens_cap" : "objects", + "leopard" : "animals", + "lesser_panda" : "animals", + "letter_opener" : "objects", + "library" : "places", + "lifeboat" : "vehicles", + "lighter" : "objects", + "limousine" : "vehicles", + "limpkin" : "birds", + "liner" : "vehicles", + "lion" : "animals", + "lionfish" : "sea animals", + "lipstick" : "objects", + "little_blue_heron" : "birds", + "llama" : "animals", + "loggerhead" : "animals", + "long-horned_beetle" : "animals", + "lorikeet" : "birds", + "lotion" : "objects", + "loudspeaker" : "electronics", + "loupe" : "objects", + "lumbermill" : "places", + "lycaenid" : "objects", + "lynx" : "animals", + "macaque" : "animals", + "macaw" : "birds", + "magnetic_compass" : "objects", + "magpie" : "birds", + "mailbag" : "objects", + "mailbox" : "objects", + "maillot" : "objects", + "malamute" : "animals", + "malinois" : "objects", + "manhole_cover" : "objects", + "mantis" : "animals", + "maraca" : "objects", + "marimba" : "objects", + "marmoset" : "animals", + "marmot" : "animals", + "mashed_potato" : "foods", + "mask" : "objects", + "matchstick" : "objects", + "maypole" : "objects", + "maze" : "objects", + "measuring_cup" : "objects", + "meat_loaf" : "foods", + "medicine_chest" : "objects", + "meerkat" : "animals", + "megalith" : "objects", + "menu" : "objects", + "microphone" : "electronics", + "microwave" : "electronics", + "military_uniform" : "dresses", + "milk_can" : "objects", + "miniature_pinscher" : "animals", + "miniature_poodle" : "animals", + "miniature_schnauzer" : "animals", + "minibus" : "vehicles", + "miniskirt" : "dresses", + "minivan" : "vehicles", + "mink" : "animals", + "missile" : "vehicles", + "mitten" : "objects", + "mixing_bowl" : "objects", + "mobile_home" : "vehicles", + "modem" : "objects", + "monarch" : "animals", + "monastery" : "places", + "mongoose" : "animals", + "monitor" : "electronics", + "moped" : "objects", + "mortar" : "objects", + "mortarboard" : "objects", + "mosque" : "places", + "mosquito_net" : "objects", + "motor_scooter" : "vehicles", + "mountain_bike" : "vehicles", + "mountain_tent" : "objects", + "mouse" : "animals", + "mousetrap" : "objects", + "moving_van" : "vehicles", + "mud_turtle" : "animals", + "mushroom" : "plants", + "muzzle" : "objects", + "nail" : "objects", + "neck_brace" : "objects", + "necklace" : "dresses", + "nematode" : "animals", + "night_snake" : "animals", + "nipple" : "objects", + "notebook" : "objects", + "obelisk" : "objects", + "oboe" : "objects", + "ocarina" : "objects", + "odometer" : "objects", + "oil_filter" : "objects", + "orange" : "foods", + "orangutan" : "animals", + "organ" : "objects", + "oscilloscope" : "objects", + "ostrich" : "animals", + "otter" : "sea animals", + "otterhound" : "animals", + "overskirt" : "dresses", + "ox" : "animals", + "oxcart" : "vehicles", + "oxygen_mask" : "objects", + "oystercatcher" : "objects", + "packet" : "objects", + "paddle" : "objects", + "paddlewheel" : "objects", + "padlock" : "objects", + "paintbrush" : "objects", + "pajama" : "dresses", + "palace" : "places", + "panpipe" : "objects", + "paper_towel" : "objects", + "papillon" : "objects", + "parachute" : "objects", + "parallel_bars" : "objects", + "park_bench" : "objects", + "parking_meter" : "objects", + "partridge" : "objects", + "passenger_car" : "vehicles", + "patas" : "objects", + "patio" : "places", + "pay-phone" : "objects", + "peacock" : "birds", + "pedestal" : "objects", + "pelican" : "birds", + "pencil_box" : "objects", + "pencil_sharpener" : "objects", + "perfume" : "objects", + "photocopier" : "electronics", + "pick" : "objects", + "pickelhaube" : "objects", + "picket_fence" : "objects", + "pickup" : "vehicles", + "pier" : "objects", + "piggy_bank" : "places", + "pill_bottle" : "objects", + "pillow" : "objects", + "pineapple" : "foods", + "ping-pong_ball" : "objects", + "pinwheel" : "objects", + "pirate" : "vehicles", + "pitcher" : "objects", + "pizza" : "foods", + "plane" : "vehicles", + "planetarium" : "places", + "plastic_bag" : "objects", + "plate" : "objects", + "plate_rack" : "objects", + "platypus" : "animals", + "plow" : "objects", + "plunger" : "objects", + "pole" : "objects", + "polecat" : "objects", + "police_van" : "vehicles", + "pomegranate" : "plants", + "poncho" : "objects", + "pool_table" : "objects", + "pop_bottle" : "objects", + "porcupine" : "animals", + "pot" : "objects", + "potpie" : "objects", + "potter's_wheel" : "objects", + "power_drill" : "objects", + "prairie_chicken" : "animals", + "prayer_rug" : "objects", + "pretzel" : "foods", + "printer" : "electronics", + "prison" : "places", + "proboscis_monkey" : "animals", + "projectile" : "objects", + "projector" : "electronics", + "promontory" : "objects", + "ptarmigan" : "animals", + "puck" : "objects", + "puffer" : "sea animals", + "pug" : "objects", + "punching_bag" : "objects", + "purse" : "objects", + "quail" : "birds", + "quill" : "objects", + "quilt" : "objects", + "racer" : "vehicles", + "racket" : "objects", + "radiator" : "objects", + "radio" : "electronics", + "radio_telescope" : "electronics", + "rain_barrel" : "objects", + "ram" : "animals", + "rapeseed" : "plants", + "recreational_vehicle" : "vehicles", + "red-backed_sandpiper" : "objects", + "red-breasted_merganser" : "objects", + "red_fox" : "animals", + "red_wine" : "objects", + "red_wolf" : "animals", + "redbone" : "animals", + "redshank" : "birds", + "reel" : "objects", + "reflex_camera" : "electronics", + "refrigerator" : "electronics", + "remote_control" : "electronics", + "restaurant" : "places", + "revolver" : "objects", + "rhinoceros_beetle" : "animals", + "rifle" : "objects", + "ringlet" : "objects", + "ringneck_snake" : "animals", + "robin" : "birds", + "rock_beauty" : "objects", + "rock_crab" : "sea animals", + "rock_python" : "animals ", + "rocking_chair" : "objects", + "rotisserie" : "objects", + "rubber_eraser" : "objects", + "ruddy_turnstone" : "birds", + "ruffed_grouse" : "birds", + "rugby_ball" : "objects", + "rule" : "objects", + "running_shoe" : "dresses", + "safe" : "objects", + "safety_pin" : "objects", + "saltshaker" : "objects", + "sandal" : "dresses", + "sandbar" : "objects", + "sarong" : "dresses", + "sax" : "objects", + "scabbard" : "objects", + "scale" : "objects", + "schipperke" : "animals", + "school_bus" : "vehicles", + "schooner" : "vehicles", + "scoreboard" : "objects", + "scorpion" : "animals", + "screen" : "electronics", + "screw" : "objects", + "screwdriver" : "objects", + "scuba_diver" : "people", + "sea_anemone" : "plants", + "sea_cucumber" : "plants", + "sea_lion" : "sea animals", + "sea_slug" : "sea animals", + "sea_snake" : "sea animals", + "sea_urchin" : "sea animals", + "seashore" : "places", + "seat_belt" : "objects", + "sewing_machine" : "objects", + "shield" : "objects", + "shoe_shop" : "places", + "shoji" : "objects", + "shopping_basket" : "objects", + "shopping_cart" : "objects", + "shovel" : "objects", + "shower_cap" : "objects", + "shower_curtain" : "objects", + "siamang" : "animals", + "sidewinder" : "animals", + "silky_terrier" : "animals", + "ski" : "people", + "ski_mask" : "objects", + "skunk" : "animals", + "sleeping_bag" : "objects", + "slide_rule" : "objects", + "sliding_door" : "objects", + "slot" : "objects", + "sloth_bear" : "animals", + "slug" : "objects", + "snail" : "animals", + "snorkel" : "objects", + "snow_leopard" : "animals", + "snowmobile" : "vehicles", + "snowplow" : "objects", + "soap_dispenser" : "objects", + "soccer_ball" : "objects", + "sock" : "objects", + "soft-coated_wheaten_terrier" : "animals", + "solar_dish" : "objects", + "sombrero" : "dresses", + "sorrel" : "plants", + "soup_bowl" : "objects", + "space_bar" : "objects", + "space_heater" : "electronics", + "space_shuttle" : "vehicles", + "spaghetti_squash" : "foods", + "spatula" : "objects", + "speedboat" : "vehicles", + "spider_monkey" : "animals", + "spider_web" : "objects", + "spindle" : "objects", + "spiny_lobster" : "sea animals", + "spoonbill" : "objects", + "sports_car" : "vehicles", + "spotlight" : "objects", + "spotted_salamander" : "animals", + "squirrel_monkey" : "animals", + "stage" : "places", + "standard_poodle" : "animals", + "standard_schnauzer" : "animals", + "starfish" : "sea animals", + "steam_locomotive" : "vehicles", + "steel_arch_bridge" : "places", + "steel_drum" : "objects", + "stethoscope" : "objects", + "stingray" : "sea animals", + "stinkhorn" : "objects", + "stole" : "dresses", + "stone_wall" : "objects", + "stopwatch" : "objects", + "stove" : "objects", + "strainer" : "objects", + "strawberry" : "foods", + "street_sign" : "objects", + "streetcar" : "vehicles", + "stretcher" : "objects", + "studio_couch" : "objects", + "stupa" : "places", + "sturgeon" : "sea animals", + "submarine" : "vehicles", + "suit" : "dresses", + "sulphur-crested_cockatoo" : "birds", + "sulphur_butterfly" : "animals", + "sundial" : "objects", + "sunglass" : "objects", + "sunglasses" : "objects", + "sunscreen" : "objects", + "suspension_bridge" : "places", + "swab" : "objects", + "sweatshirt" : "dresses", + "swimming_trunks" : "dresses", + "swing" : "objects", + "switch" : "objects", + "syringe" : "objects", + "tabby" : "dresses", + "table_lamp" : "objects", + "tailed_frog" : "animals", + "tank" : "objects", + "tape_player" : "electronics", + "tarantula" : "animals", + "teapot" : "objects", + "teddy" : "objects", + "television" : "electronics", + "tench" : "sea animals", + "tennis_ball" : "objects", + "terrapin" : "animals", + "thatch" : "objects", + "theater_curtain" : "objects", + "thimble" : "objects", + "three-toed_sloth" : "objects", + "thresher" : "people", + "throne" : "places", + "thunder_snake" : "animals", + "tick" : "animals", + "tiger" : "animals", + "tiger_beetle" : "animals", + "tiger_cat" : "animals", + "tiger_shark" : "animals", + "tile_roof" : "objects", + "timber_wolf" : "animals", + "titi" : "animals", + "toaster" : "objects", + "tobacco_shop" : "places", + "toilet_seat" : "objects", + "toilet_tissue" : "objects", + "torch" : "objects", + "totem_pole" : "objects", + "toucan" : "birds", + "tow_truck" : "vehicles", + "toy_poodle" : "objects", + "toy_terrier" : "objects", + "toyshop" : "places", + "tractor" : "vehicles", + "traffic_light" : "objects", + "trailer_truck" : "objects", + "tray" : "objects", + "tree_frog" : "animals", + "trench_coat" : "dresses", + "triceratops" : "animals", + "tricycle" : "vehicles", + "trifle" : "foods", + "trilobite" : "animals", + "trimaran" : "objects", + "tripod" : "objects", + "triumphal_arch" : "objects", + "trolleybus" : "vehicles", + "trombone" : "objects", + "tub" : "objects", + "turnstile" : "objects", + "tusker" : "objects", + "typewriter_keyboard" : "electronics", + "umbrella" : "objects", + "unicycle" : "objects", + "upright" : "category", + "vacuum" : "objects", + "valley" : "plaves", + "vase" : "objects", + "vault" : "objects", + "velvet" : "dresses", + "vending_machine" : "electronics", + "vestment" : "dresses", + "viaduct" : "objects", + "vine_snake" : "animals", + "violin" : "objects", + "vizsla" : "animals", + "volcano" : "places", + "volleyball" : "objects", + "vulture" : "animals", + "waffle_iron" : "objects", + "walking_stick" : "objects", + "wall_clock" : "objects", + "wallaby" : "animals", + "wallet" : "objects", + "wardrobe" : "objects", + "warplane" : "aircrafts", + "warthog" : "animals", + "washbasin" : "objects", + "washer" : "objects", + "water_bottle" : "objects", + "water_buffalo" : "sea animals", + "water_jug" : "objects", + "water_ouzel" : "birds", + "water_snake" : "animals", + "water_tower" : "objects", + "weasel" : "animals", + "web_site" : "electronics", + "weevil" : "animals", + "whippet" : "animals", + "whiptail" : "objects", + "whiskey_jug" : "objects", + "whistle" : "objects", + "white_stork" : "birds", + "white_wolf" : "animals", + "wig" : "objects", + "wild_boar" : "animals", + "window_screen" : "objects", + "window_shade" : "objects", + "wine_bottle" : "objects", + "wing" : "objects", + "wire-haired_fox_terrier" : "animals", + "wok" : "objects", + "wolf_spider" : "animals", + "wombat" : "animals", + "wood_rabbit" : "animals", + "wooden_spoon" : "objects", + "wool" : "objects", + "worm_fence" : "objects", + "wreck" : "objects", + "yawl" : "vehicles", + "yellow_lady's_slipper" : "dresses", + "yurt" : "places", + "zebra" : "animals", + "zucchini" : "plants" +} \ No newline at end of file diff --git a/imagenet_class_index.json b/imagenet_class_index.json new file mode 100644 index 0000000..5fe0dfe --- /dev/null +++ b/imagenet_class_index.json @@ -0,0 +1 @@ +{"0": ["n01440764", "tench"], "1": ["n01443537", "goldfish"], "2": ["n01484850", "great_white_shark"], "3": ["n01491361", "tiger_shark"], "4": ["n01494475", "hammerhead"], "5": ["n01496331", "electric_ray"], "6": ["n01498041", "stingray"], "7": ["n01514668", "cock"], "8": ["n01514859", "hen"], "9": ["n01518878", "ostrich"], "10": ["n01530575", "brambling"], "11": ["n01531178", "goldfinch"], "12": ["n01532829", "house_finch"], "13": ["n01534433", "junco"], "14": ["n01537544", "indigo_bunting"], "15": ["n01558993", "robin"], "16": ["n01560419", "bulbul"], "17": ["n01580077", "jay"], "18": ["n01582220", "magpie"], "19": ["n01592084", "chickadee"], "20": ["n01601694", "water_ouzel"], "21": ["n01608432", "kite"], "22": ["n01614925", "bald_eagle"], "23": ["n01616318", "vulture"], "24": ["n01622779", "great_grey_owl"], "25": ["n01629819", "European_fire_salamander"], "26": ["n01630670", "common_newt"], "27": ["n01631663", "eft"], "28": ["n01632458", "spotted_salamander"], "29": ["n01632777", "axolotl"], "30": ["n01641577", "bullfrog"], "31": ["n01644373", "tree_frog"], "32": ["n01644900", "tailed_frog"], "33": ["n01664065", "loggerhead"], "34": ["n01665541", "leatherback_turtle"], "35": ["n01667114", "mud_turtle"], "36": ["n01667778", "terrapin"], "37": ["n01669191", "box_turtle"], "38": ["n01675722", "banded_gecko"], "39": ["n01677366", "common_iguana"], "40": ["n01682714", "American_chameleon"], "41": ["n01685808", "whiptail"], "42": ["n01687978", "agama"], "43": ["n01688243", "frilled_lizard"], "44": ["n01689811", "alligator_lizard"], "45": ["n01692333", "Gila_monster"], "46": ["n01693334", "green_lizard"], "47": ["n01694178", "African_chameleon"], "48": ["n01695060", "Komodo_dragon"], "49": ["n01697457", "African_crocodile"], "50": ["n01698640", "American_alligator"], "51": ["n01704323", "triceratops"], "52": ["n01728572", "thunder_snake"], "53": ["n01728920", "ringneck_snake"], "54": ["n01729322", "hognose_snake"], "55": ["n01729977", "green_snake"], "56": ["n01734418", "king_snake"], "57": ["n01735189", "garter_snake"], "58": ["n01737021", "water_snake"], "59": ["n01739381", "vine_snake"], "60": ["n01740131", "night_snake"], "61": ["n01742172", "boa_constrictor"], "62": ["n01744401", "rock_python"], "63": ["n01748264", "Indian_cobra"], "64": ["n01749939", "green_mamba"], "65": ["n01751748", "sea_snake"], "66": ["n01753488", "horned_viper"], "67": ["n01755581", "diamondback"], "68": ["n01756291", "sidewinder"], "69": ["n01768244", "trilobite"], "70": ["n01770081", "harvestman"], "71": ["n01770393", "scorpion"], "72": ["n01773157", "black_and_gold_garden_spider"], "73": ["n01773549", "barn_spider"], "74": ["n01773797", "garden_spider"], "75": ["n01774384", "black_widow"], "76": ["n01774750", "tarantula"], "77": ["n01775062", "wolf_spider"], "78": ["n01776313", "tick"], "79": ["n01784675", "centipede"], "80": ["n01795545", "black_grouse"], "81": ["n01796340", "ptarmigan"], "82": ["n01797886", "ruffed_grouse"], "83": ["n01798484", "prairie_chicken"], "84": ["n01806143", "peacock"], "85": ["n01806567", "quail"], "86": ["n01807496", "partridge"], "87": ["n01817953", "African_grey"], "88": ["n01818515", "macaw"], "89": ["n01819313", "sulphur-crested_cockatoo"], "90": ["n01820546", "lorikeet"], "91": ["n01824575", "coucal"], "92": ["n01828970", "bee_eater"], "93": ["n01829413", "hornbill"], "94": ["n01833805", "hummingbird"], "95": ["n01843065", "jacamar"], "96": ["n01843383", "toucan"], "97": ["n01847000", "drake"], "98": ["n01855032", "red-breasted_merganser"], "99": ["n01855672", "goose"], "100": ["n01860187", "black_swan"], "101": ["n01871265", "tusker"], "102": ["n01872401", "echidna"], "103": ["n01873310", "platypus"], "104": ["n01877812", "wallaby"], "105": ["n01882714", "koala"], "106": ["n01883070", "wombat"], "107": ["n01910747", "jellyfish"], "108": ["n01914609", "sea_anemone"], "109": ["n01917289", "brain_coral"], "110": ["n01924916", "flatworm"], "111": ["n01930112", "nematode"], "112": ["n01943899", "conch"], "113": ["n01944390", "snail"], "114": ["n01945685", "slug"], "115": ["n01950731", "sea_slug"], "116": ["n01955084", "chiton"], "117": ["n01968897", "chambered_nautilus"], "118": ["n01978287", "Dungeness_crab"], "119": ["n01978455", "rock_crab"], "120": ["n01980166", "fiddler_crab"], "121": ["n01981276", "king_crab"], "122": ["n01983481", "American_lobster"], "123": ["n01984695", "spiny_lobster"], "124": ["n01985128", "crayfish"], "125": ["n01986214", "hermit_crab"], "126": ["n01990800", "isopod"], "127": ["n02002556", "white_stork"], "128": ["n02002724", "black_stork"], "129": ["n02006656", "spoonbill"], "130": ["n02007558", "flamingo"], "131": ["n02009229", "little_blue_heron"], "132": ["n02009912", "American_egret"], "133": ["n02011460", "bittern"], "134": ["n02012849", "crane"], "135": ["n02013706", "limpkin"], "136": ["n02017213", "European_gallinule"], "137": ["n02018207", "American_coot"], "138": ["n02018795", "bustard"], "139": ["n02025239", "ruddy_turnstone"], "140": ["n02027492", "red-backed_sandpiper"], "141": ["n02028035", "redshank"], "142": ["n02033041", "dowitcher"], "143": ["n02037110", "oystercatcher"], "144": ["n02051845", "pelican"], "145": ["n02056570", "king_penguin"], "146": ["n02058221", "albatross"], "147": ["n02066245", "grey_whale"], "148": ["n02071294", "killer_whale"], "149": ["n02074367", "dugong"], "150": ["n02077923", "sea_lion"], "151": ["n02085620", "Chihuahua"], "152": ["n02085782", "Japanese_spaniel"], "153": ["n02085936", "Maltese_dog"], "154": ["n02086079", "Pekinese"], "155": ["n02086240", "Shih-Tzu"], "156": ["n02086646", "Blenheim_spaniel"], "157": ["n02086910", "papillon"], "158": ["n02087046", "toy_terrier"], "159": ["n02087394", "Rhodesian_ridgeback"], "160": ["n02088094", "Afghan_hound"], "161": ["n02088238", "basset"], "162": ["n02088364", "beagle"], "163": ["n02088466", "bloodhound"], "164": ["n02088632", "bluetick"], "165": ["n02089078", "black-and-tan_coonhound"], "166": ["n02089867", "Walker_hound"], "167": ["n02089973", "English_foxhound"], "168": ["n02090379", "redbone"], "169": ["n02090622", "borzoi"], "170": ["n02090721", "Irish_wolfhound"], "171": ["n02091032", "Italian_greyhound"], "172": ["n02091134", "whippet"], "173": ["n02091244", "Ibizan_hound"], "174": ["n02091467", "Norwegian_elkhound"], "175": ["n02091635", "otterhound"], "176": ["n02091831", "Saluki"], "177": ["n02092002", "Scottish_deerhound"], "178": ["n02092339", "Weimaraner"], "179": ["n02093256", "Staffordshire_bullterrier"], "180": ["n02093428", "American_Staffordshire_terrier"], "181": ["n02093647", "Bedlington_terrier"], "182": ["n02093754", "Border_terrier"], "183": ["n02093859", "Kerry_blue_terrier"], "184": ["n02093991", "Irish_terrier"], "185": ["n02094114", "Norfolk_terrier"], "186": ["n02094258", "Norwich_terrier"], "187": ["n02094433", "Yorkshire_terrier"], "188": ["n02095314", "wire-haired_fox_terrier"], "189": ["n02095570", "Lakeland_terrier"], "190": ["n02095889", "Sealyham_terrier"], "191": ["n02096051", "Airedale"], "192": ["n02096177", "cairn"], "193": ["n02096294", "Australian_terrier"], "194": ["n02096437", "Dandie_Dinmont"], "195": ["n02096585", "Boston_bull"], "196": ["n02097047", "miniature_schnauzer"], "197": ["n02097130", "giant_schnauzer"], "198": ["n02097209", "standard_schnauzer"], "199": ["n02097298", "Scotch_terrier"], "200": ["n02097474", "Tibetan_terrier"], "201": ["n02097658", "silky_terrier"], "202": ["n02098105", "soft-coated_wheaten_terrier"], "203": ["n02098286", "West_Highland_white_terrier"], "204": ["n02098413", "Lhasa"], "205": ["n02099267", "flat-coated_retriever"], "206": ["n02099429", "curly-coated_retriever"], "207": ["n02099601", "golden_retriever"], "208": ["n02099712", "Labrador_retriever"], "209": ["n02099849", "Chesapeake_Bay_retriever"], "210": ["n02100236", "German_short-haired_pointer"], "211": ["n02100583", "vizsla"], "212": ["n02100735", "English_setter"], "213": ["n02100877", "Irish_setter"], "214": ["n02101006", "Gordon_setter"], "215": ["n02101388", "Brittany_spaniel"], "216": ["n02101556", "clumber"], "217": ["n02102040", "English_springer"], "218": ["n02102177", "Welsh_springer_spaniel"], "219": ["n02102318", "cocker_spaniel"], "220": ["n02102480", "Sussex_spaniel"], "221": ["n02102973", "Irish_water_spaniel"], "222": ["n02104029", "kuvasz"], "223": ["n02104365", "schipperke"], "224": ["n02105056", "groenendael"], "225": ["n02105162", "malinois"], "226": ["n02105251", "briard"], "227": ["n02105412", "kelpie"], "228": ["n02105505", "komondor"], "229": ["n02105641", "Old_English_sheepdog"], "230": ["n02105855", "Shetland_sheepdog"], "231": ["n02106030", "collie"], "232": ["n02106166", "Border_collie"], "233": ["n02106382", "Bouvier_des_Flandres"], "234": ["n02106550", "Rottweiler"], "235": ["n02106662", "German_shepherd"], "236": ["n02107142", "Doberman"], "237": ["n02107312", "miniature_pinscher"], "238": ["n02107574", "Greater_Swiss_Mountain_dog"], "239": ["n02107683", "Bernese_mountain_dog"], "240": ["n02107908", "Appenzeller"], "241": ["n02108000", "EntleBucher"], "242": ["n02108089", "boxer"], "243": ["n02108422", "bull_mastiff"], "244": ["n02108551", "Tibetan_mastiff"], "245": ["n02108915", "French_bulldog"], "246": ["n02109047", "Great_Dane"], "247": ["n02109525", "Saint_Bernard"], "248": ["n02109961", "Eskimo_dog"], "249": ["n02110063", "malamute"], "250": ["n02110185", "Siberian_husky"], "251": ["n02110341", "dalmatian"], "252": ["n02110627", "affenpinscher"], "253": ["n02110806", "basenji"], "254": ["n02110958", "pug"], "255": ["n02111129", "Leonberg"], "256": ["n02111277", "Newfoundland"], "257": ["n02111500", "Great_Pyrenees"], "258": ["n02111889", "Samoyed"], "259": ["n02112018", "Pomeranian"], "260": ["n02112137", "chow"], "261": ["n02112350", "keeshond"], "262": ["n02112706", "Brabancon_griffon"], "263": ["n02113023", "Pembroke"], "264": ["n02113186", "Cardigan"], "265": ["n02113624", "toy_poodle"], "266": ["n02113712", "miniature_poodle"], "267": ["n02113799", "standard_poodle"], "268": ["n02113978", "Mexican_hairless"], "269": ["n02114367", "timber_wolf"], "270": ["n02114548", "white_wolf"], "271": ["n02114712", "red_wolf"], "272": ["n02114855", "coyote"], "273": ["n02115641", "dingo"], "274": ["n02115913", "dhole"], "275": ["n02116738", "African_hunting_dog"], "276": ["n02117135", "hyena"], "277": ["n02119022", "red_fox"], "278": ["n02119789", "kit_fox"], "279": ["n02120079", "Arctic_fox"], "280": ["n02120505", "grey_fox"], "281": ["n02123045", "tabby"], "282": ["n02123159", "tiger_cat"], "283": ["n02123394", "Persian_cat"], "284": ["n02123597", "Siamese_cat"], "285": ["n02124075", "Egyptian_cat"], "286": ["n02125311", "cougar"], "287": ["n02127052", "lynx"], "288": ["n02128385", "leopard"], "289": ["n02128757", "snow_leopard"], "290": ["n02128925", "jaguar"], "291": ["n02129165", "lion"], "292": ["n02129604", "tiger"], "293": ["n02130308", "cheetah"], "294": ["n02132136", "brown_bear"], "295": ["n02133161", "American_black_bear"], "296": ["n02134084", "ice_bear"], "297": ["n02134418", "sloth_bear"], "298": ["n02137549", "mongoose"], "299": ["n02138441", "meerkat"], "300": ["n02165105", "tiger_beetle"], "301": ["n02165456", "ladybug"], "302": ["n02167151", "ground_beetle"], "303": ["n02168699", "long-horned_beetle"], "304": ["n02169497", "leaf_beetle"], "305": ["n02172182", "dung_beetle"], "306": ["n02174001", "rhinoceros_beetle"], "307": ["n02177972", "weevil"], "308": ["n02190166", "fly"], "309": ["n02206856", "bee"], "310": ["n02219486", "ant"], "311": ["n02226429", "grasshopper"], "312": ["n02229544", "cricket"], "313": ["n02231487", "walking_stick"], "314": ["n02233338", "cockroach"], "315": ["n02236044", "mantis"], "316": ["n02256656", "cicada"], "317": ["n02259212", "leafhopper"], "318": ["n02264363", "lacewing"], "319": ["n02268443", "dragonfly"], "320": ["n02268853", "damselfly"], "321": ["n02276258", "admiral"], "322": ["n02277742", "ringlet"], "323": ["n02279972", "monarch"], "324": ["n02280649", "cabbage_butterfly"], "325": ["n02281406", "sulphur_butterfly"], "326": ["n02281787", "lycaenid"], "327": ["n02317335", "starfish"], "328": ["n02319095", "sea_urchin"], "329": ["n02321529", "sea_cucumber"], "330": ["n02325366", "wood_rabbit"], "331": ["n02326432", "hare"], "332": ["n02328150", "Angora"], "333": ["n02342885", "hamster"], "334": ["n02346627", "porcupine"], "335": ["n02356798", "fox_squirrel"], "336": ["n02361337", "marmot"], "337": ["n02363005", "beaver"], "338": ["n02364673", "guinea_pig"], "339": ["n02389026", "sorrel"], "340": ["n02391049", "zebra"], "341": ["n02395406", "hog"], "342": ["n02396427", "wild_boar"], "343": ["n02397096", "warthog"], "344": ["n02398521", "hippopotamus"], "345": ["n02403003", "ox"], "346": ["n02408429", "water_buffalo"], "347": ["n02410509", "bison"], "348": ["n02412080", "ram"], "349": ["n02415577", "bighorn"], "350": ["n02417914", "ibex"], "351": ["n02422106", "hartebeest"], "352": ["n02422699", "impala"], "353": ["n02423022", "gazelle"], "354": ["n02437312", "Arabian_camel"], "355": ["n02437616", "llama"], "356": ["n02441942", "weasel"], "357": ["n02442845", "mink"], "358": ["n02443114", "polecat"], "359": ["n02443484", "black-footed_ferret"], "360": ["n02444819", "otter"], "361": ["n02445715", "skunk"], "362": ["n02447366", "badger"], "363": ["n02454379", "armadillo"], "364": ["n02457408", "three-toed_sloth"], "365": ["n02480495", "orangutan"], "366": ["n02480855", "gorilla"], "367": ["n02481823", "chimpanzee"], "368": ["n02483362", "gibbon"], "369": ["n02483708", "siamang"], "370": ["n02484975", "guenon"], "371": ["n02486261", "patas"], "372": ["n02486410", "baboon"], "373": ["n02487347", "macaque"], "374": ["n02488291", "langur"], "375": ["n02488702", "colobus"], "376": ["n02489166", "proboscis_monkey"], "377": ["n02490219", "marmoset"], "378": ["n02492035", "capuchin"], "379": ["n02492660", "howler_monkey"], "380": ["n02493509", "titi"], "381": ["n02493793", "spider_monkey"], "382": ["n02494079", "squirrel_monkey"], "383": ["n02497673", "Madagascar_cat"], "384": ["n02500267", "indri"], "385": ["n02504013", "Indian_elephant"], "386": ["n02504458", "African_elephant"], "387": ["n02509815", "lesser_panda"], "388": ["n02510455", "giant_panda"], "389": ["n02514041", "barracouta"], "390": ["n02526121", "eel"], "391": ["n02536864", "coho"], "392": ["n02606052", "rock_beauty"], "393": ["n02607072", "anemone_fish"], "394": ["n02640242", "sturgeon"], "395": ["n02641379", "gar"], "396": ["n02643566", "lionfish"], "397": ["n02655020", "puffer"], "398": ["n02666196", "abacus"], "399": ["n02667093", "abaya"], "400": ["n02669723", "academic_gown"], "401": ["n02672831", "accordion"], "402": ["n02676566", "acoustic_guitar"], "403": ["n02687172", "aircraft_carrier"], "404": ["n02690373", "airliner"], "405": ["n02692877", "airship"], "406": ["n02699494", "altar"], "407": ["n02701002", "ambulance"], "408": ["n02704792", "amphibian"], "409": ["n02708093", "analog_clock"], "410": ["n02727426", "apiary"], "411": ["n02730930", "apron"], "412": ["n02747177", "ashcan"], "413": ["n02749479", "assault_rifle"], "414": ["n02769748", "backpack"], "415": ["n02776631", "bakery"], "416": ["n02777292", "balance_beam"], "417": ["n02782093", "balloon"], "418": ["n02783161", "ballpoint"], "419": ["n02786058", "Band_Aid"], "420": ["n02787622", "banjo"], "421": ["n02788148", "bannister"], "422": ["n02790996", "barbell"], "423": ["n02791124", "barber_chair"], "424": ["n02791270", "barbershop"], "425": ["n02793495", "barn"], "426": ["n02794156", "barometer"], "427": ["n02795169", "barrel"], "428": ["n02797295", "barrow"], "429": ["n02799071", "baseball"], "430": ["n02802426", "basketball"], "431": ["n02804414", "bassinet"], "432": ["n02804610", "bassoon"], "433": ["n02807133", "bathing_cap"], "434": ["n02808304", "bath_towel"], "435": ["n02808440", "bathtub"], "436": ["n02814533", "beach_wagon"], "437": ["n02814860", "beacon"], "438": ["n02815834", "beaker"], "439": ["n02817516", "bearskin"], "440": ["n02823428", "beer_bottle"], "441": ["n02823750", "beer_glass"], "442": ["n02825657", "bell_cote"], "443": ["n02834397", "bib"], "444": ["n02835271", "bicycle-built-for-two"], "445": ["n02837789", "bikini"], "446": ["n02840245", "binder"], "447": ["n02841315", "binoculars"], "448": ["n02843684", "birdhouse"], "449": ["n02859443", "boathouse"], "450": ["n02860847", "bobsled"], "451": ["n02865351", "bolo_tie"], "452": ["n02869837", "bonnet"], "453": ["n02870880", "bookcase"], "454": ["n02871525", "bookshop"], "455": ["n02877765", "bottlecap"], "456": ["n02879718", "bow"], "457": ["n02883205", "bow_tie"], "458": ["n02892201", "brass"], "459": ["n02892767", "brassiere"], "460": ["n02894605", "breakwater"], "461": ["n02895154", "breastplate"], "462": ["n02906734", "broom"], "463": ["n02909870", "bucket"], "464": ["n02910353", "buckle"], "465": ["n02916936", "bulletproof_vest"], "466": ["n02917067", "bullet_train"], "467": ["n02927161", "butcher_shop"], "468": ["n02930766", "cab"], "469": ["n02939185", "caldron"], "470": ["n02948072", "candle"], "471": ["n02950826", "cannon"], "472": ["n02951358", "canoe"], "473": ["n02951585", "can_opener"], "474": ["n02963159", "cardigan"], "475": ["n02965783", "car_mirror"], "476": ["n02966193", "carousel"], "477": ["n02966687", "carpenter's_kit"], "478": ["n02971356", "carton"], "479": ["n02974003", "car_wheel"], "480": ["n02977058", "cash_machine"], "481": ["n02978881", "cassette"], "482": ["n02979186", "cassette_player"], "483": ["n02980441", "castle"], "484": ["n02981792", "catamaran"], "485": ["n02988304", "CD_player"], "486": ["n02992211", "cello"], "487": ["n02992529", "cellular_telephone"], "488": ["n02999410", "chain"], "489": ["n03000134", "chainlink_fence"], "490": ["n03000247", "chain_mail"], "491": ["n03000684", "chain_saw"], "492": ["n03014705", "chest"], "493": ["n03016953", "chiffonier"], "494": ["n03017168", "chime"], "495": ["n03018349", "china_cabinet"], "496": ["n03026506", "Christmas_stocking"], "497": ["n03028079", "church"], "498": ["n03032252", "cinema"], "499": ["n03041632", "cleaver"], "500": ["n03042490", "cliff_dwelling"], "501": ["n03045698", "cloak"], "502": ["n03047690", "clog"], "503": ["n03062245", "cocktail_shaker"], "504": ["n03063599", "coffee_mug"], "505": ["n03063689", "coffeepot"], "506": ["n03065424", "coil"], "507": ["n03075370", "combination_lock"], "508": ["n03085013", "computer_keyboard"], "509": ["n03089624", "confectionery"], "510": ["n03095699", "container_ship"], "511": ["n03100240", "convertible"], "512": ["n03109150", "corkscrew"], "513": ["n03110669", "cornet"], "514": ["n03124043", "cowboy_boot"], "515": ["n03124170", "cowboy_hat"], "516": ["n03125729", "cradle"], "517": ["n03126707", "crane"], "518": ["n03127747", "crash_helmet"], "519": ["n03127925", "crate"], "520": ["n03131574", "crib"], "521": ["n03133878", "Crock_Pot"], "522": ["n03134739", "croquet_ball"], "523": ["n03141823", "crutch"], "524": ["n03146219", "cuirass"], "525": ["n03160309", "dam"], "526": ["n03179701", "desk"], "527": ["n03180011", "desktop_computer"], "528": ["n03187595", "dial_telephone"], "529": ["n03188531", "diaper"], "530": ["n03196217", "digital_clock"], "531": ["n03197337", "digital_watch"], "532": ["n03201208", "dining_table"], "533": ["n03207743", "dishrag"], "534": ["n03207941", "dishwasher"], "535": ["n03208938", "disk_brake"], "536": ["n03216828", "dock"], "537": ["n03218198", "dogsled"], "538": ["n03220513", "dome"], "539": ["n03223299", "doormat"], "540": ["n03240683", "drilling_platform"], "541": ["n03249569", "drum"], "542": ["n03250847", "drumstick"], "543": ["n03255030", "dumbbell"], "544": ["n03259280", "Dutch_oven"], "545": ["n03271574", "electric_fan"], "546": ["n03272010", "electric_guitar"], "547": ["n03272562", "electric_locomotive"], "548": ["n03290653", "entertainment_center"], "549": ["n03291819", "envelope"], "550": ["n03297495", "espresso_maker"], "551": ["n03314780", "face_powder"], "552": ["n03325584", "feather_boa"], "553": ["n03337140", "file"], "554": ["n03344393", "fireboat"], "555": ["n03345487", "fire_engine"], "556": ["n03347037", "fire_screen"], "557": ["n03355925", "flagpole"], "558": ["n03372029", "flute"], "559": ["n03376595", "folding_chair"], "560": ["n03379051", "football_helmet"], "561": ["n03384352", "forklift"], "562": ["n03388043", "fountain"], "563": ["n03388183", "fountain_pen"], "564": ["n03388549", "four-poster"], "565": ["n03393912", "freight_car"], "566": ["n03394916", "French_horn"], "567": ["n03400231", "frying_pan"], "568": ["n03404251", "fur_coat"], "569": ["n03417042", "garbage_truck"], "570": ["n03424325", "gasmask"], "571": ["n03425413", "gas_pump"], "572": ["n03443371", "goblet"], "573": ["n03444034", "go-kart"], "574": ["n03445777", "golf_ball"], "575": ["n03445924", "golfcart"], "576": ["n03447447", "gondola"], "577": ["n03447721", "gong"], "578": ["n03450230", "gown"], "579": ["n03452741", "grand_piano"], "580": ["n03457902", "greenhouse"], "581": ["n03459775", "grille"], "582": ["n03461385", "grocery_store"], "583": ["n03467068", "guillotine"], "584": ["n03476684", "hair_slide"], "585": ["n03476991", "hair_spray"], "586": ["n03478589", "half_track"], "587": ["n03481172", "hammer"], "588": ["n03482405", "hamper"], "589": ["n03483316", "hand_blower"], "590": ["n03485407", "hand-held_computer"], "591": ["n03485794", "handkerchief"], "592": ["n03492542", "hard_disc"], "593": ["n03494278", "harmonica"], "594": ["n03495258", "harp"], "595": ["n03496892", "harvester"], "596": ["n03498962", "hatchet"], "597": ["n03527444", "holster"], "598": ["n03529860", "home_theater"], "599": ["n03530642", "honeycomb"], "600": ["n03532672", "hook"], "601": ["n03534580", "hoopskirt"], "602": ["n03535780", "horizontal_bar"], "603": ["n03538406", "horse_cart"], "604": ["n03544143", "hourglass"], "605": ["n03584254", "iPod"], "606": ["n03584829", "iron"], "607": ["n03590841", "jack-o'-lantern"], "608": ["n03594734", "jean"], "609": ["n03594945", "jeep"], "610": ["n03595614", "jersey"], "611": ["n03598930", "jigsaw_puzzle"], "612": ["n03599486", "jinrikisha"], "613": ["n03602883", "joystick"], "614": ["n03617480", "kimono"], "615": ["n03623198", "knee_pad"], "616": ["n03627232", "knot"], "617": ["n03630383", "lab_coat"], "618": ["n03633091", "ladle"], "619": ["n03637318", "lampshade"], "620": ["n03642806", "laptop"], "621": ["n03649909", "lawn_mower"], "622": ["n03657121", "lens_cap"], "623": ["n03658185", "letter_opener"], "624": ["n03661043", "library"], "625": ["n03662601", "lifeboat"], "626": ["n03666591", "lighter"], "627": ["n03670208", "limousine"], "628": ["n03673027", "liner"], "629": ["n03676483", "lipstick"], "630": ["n03680355", "Loafer"], "631": ["n03690938", "lotion"], "632": ["n03691459", "loudspeaker"], "633": ["n03692522", "loupe"], "634": ["n03697007", "lumbermill"], "635": ["n03706229", "magnetic_compass"], "636": ["n03709823", "mailbag"], "637": ["n03710193", "mailbox"], "638": ["n03710637", "maillot"], "639": ["n03710721", "maillot"], "640": ["n03717622", "manhole_cover"], "641": ["n03720891", "maraca"], "642": ["n03721384", "marimba"], "643": ["n03724870", "mask"], "644": ["n03729826", "matchstick"], "645": ["n03733131", "maypole"], "646": ["n03733281", "maze"], "647": ["n03733805", "measuring_cup"], "648": ["n03742115", "medicine_chest"], "649": ["n03743016", "megalith"], "650": ["n03759954", "microphone"], "651": ["n03761084", "microwave"], "652": ["n03763968", "military_uniform"], "653": ["n03764736", "milk_can"], "654": ["n03769881", "minibus"], "655": ["n03770439", "miniskirt"], "656": ["n03770679", "minivan"], "657": ["n03773504", "missile"], "658": ["n03775071", "mitten"], "659": ["n03775546", "mixing_bowl"], "660": ["n03776460", "mobile_home"], "661": ["n03777568", "Model_T"], "662": ["n03777754", "modem"], "663": ["n03781244", "monastery"], "664": ["n03782006", "monitor"], "665": ["n03785016", "moped"], "666": ["n03786901", "mortar"], "667": ["n03787032", "mortarboard"], "668": ["n03788195", "mosque"], "669": ["n03788365", "mosquito_net"], "670": ["n03791053", "motor_scooter"], "671": ["n03792782", "mountain_bike"], "672": ["n03792972", "mountain_tent"], "673": ["n03793489", "mouse"], "674": ["n03794056", "mousetrap"], "675": ["n03796401", "moving_van"], "676": ["n03803284", "muzzle"], "677": ["n03804744", "nail"], "678": ["n03814639", "neck_brace"], "679": ["n03814906", "necklace"], "680": ["n03825788", "nipple"], "681": ["n03832673", "notebook"], "682": ["n03837869", "obelisk"], "683": ["n03838899", "oboe"], "684": ["n03840681", "ocarina"], "685": ["n03841143", "odometer"], "686": ["n03843555", "oil_filter"], "687": ["n03854065", "organ"], "688": ["n03857828", "oscilloscope"], "689": ["n03866082", "overskirt"], "690": ["n03868242", "oxcart"], "691": ["n03868863", "oxygen_mask"], "692": ["n03871628", "packet"], "693": ["n03873416", "paddle"], "694": ["n03874293", "paddlewheel"], "695": ["n03874599", "padlock"], "696": ["n03876231", "paintbrush"], "697": ["n03877472", "pajama"], "698": ["n03877845", "palace"], "699": ["n03884397", "panpipe"], "700": ["n03887697", "paper_towel"], "701": ["n03888257", "parachute"], "702": ["n03888605", "parallel_bars"], "703": ["n03891251", "park_bench"], "704": ["n03891332", "parking_meter"], "705": ["n03895866", "passenger_car"], "706": ["n03899768", "patio"], "707": ["n03902125", "pay-phone"], "708": ["n03903868", "pedestal"], "709": ["n03908618", "pencil_box"], "710": ["n03908714", "pencil_sharpener"], "711": ["n03916031", "perfume"], "712": ["n03920288", "Petri_dish"], "713": ["n03924679", "photocopier"], "714": ["n03929660", "pick"], "715": ["n03929855", "pickelhaube"], "716": ["n03930313", "picket_fence"], "717": ["n03930630", "pickup"], "718": ["n03933933", "pier"], "719": ["n03935335", "piggy_bank"], "720": ["n03937543", "pill_bottle"], "721": ["n03938244", "pillow"], "722": ["n03942813", "ping-pong_ball"], "723": ["n03944341", "pinwheel"], "724": ["n03947888", "pirate"], "725": ["n03950228", "pitcher"], "726": ["n03954731", "plane"], "727": ["n03956157", "planetarium"], "728": ["n03958227", "plastic_bag"], "729": ["n03961711", "plate_rack"], "730": ["n03967562", "plow"], "731": ["n03970156", "plunger"], "732": ["n03976467", "Polaroid_camera"], "733": ["n03976657", "pole"], "734": ["n03977966", "police_van"], "735": ["n03980874", "poncho"], "736": ["n03982430", "pool_table"], "737": ["n03983396", "pop_bottle"], "738": ["n03991062", "pot"], "739": ["n03992509", "potter's_wheel"], "740": ["n03995372", "power_drill"], "741": ["n03998194", "prayer_rug"], "742": ["n04004767", "printer"], "743": ["n04005630", "prison"], "744": ["n04008634", "projectile"], "745": ["n04009552", "projector"], "746": ["n04019541", "puck"], "747": ["n04023962", "punching_bag"], "748": ["n04026417", "purse"], "749": ["n04033901", "quill"], "750": ["n04033995", "quilt"], "751": ["n04037443", "racer"], "752": ["n04039381", "racket"], "753": ["n04040759", "radiator"], "754": ["n04041544", "radio"], "755": ["n04044716", "radio_telescope"], "756": ["n04049303", "rain_barrel"], "757": ["n04065272", "recreational_vehicle"], "758": ["n04067472", "reel"], "759": ["n04069434", "reflex_camera"], "760": ["n04070727", "refrigerator"], "761": ["n04074963", "remote_control"], "762": ["n04081281", "restaurant"], "763": ["n04086273", "revolver"], "764": ["n04090263", "rifle"], "765": ["n04099969", "rocking_chair"], "766": ["n04111531", "rotisserie"], "767": ["n04116512", "rubber_eraser"], "768": ["n04118538", "rugby_ball"], "769": ["n04118776", "rule"], "770": ["n04120489", "running_shoe"], "771": ["n04125021", "safe"], "772": ["n04127249", "safety_pin"], "773": ["n04131690", "saltshaker"], "774": ["n04133789", "sandal"], "775": ["n04136333", "sarong"], "776": ["n04141076", "sax"], "777": ["n04141327", "scabbard"], "778": ["n04141975", "scale"], "779": ["n04146614", "school_bus"], "780": ["n04147183", "schooner"], "781": ["n04149813", "scoreboard"], "782": ["n04152593", "screen"], "783": ["n04153751", "screw"], "784": ["n04154565", "screwdriver"], "785": ["n04162706", "seat_belt"], "786": ["n04179913", "sewing_machine"], "787": ["n04192698", "shield"], "788": ["n04200800", "shoe_shop"], "789": ["n04201297", "shoji"], "790": ["n04204238", "shopping_basket"], "791": ["n04204347", "shopping_cart"], "792": ["n04208210", "shovel"], "793": ["n04209133", "shower_cap"], "794": ["n04209239", "shower_curtain"], "795": ["n04228054", "ski"], "796": ["n04229816", "ski_mask"], "797": ["n04235860", "sleeping_bag"], "798": ["n04238763", "slide_rule"], "799": ["n04239074", "sliding_door"], "800": ["n04243546", "slot"], "801": ["n04251144", "snorkel"], "802": ["n04252077", "snowmobile"], "803": ["n04252225", "snowplow"], "804": ["n04254120", "soap_dispenser"], "805": ["n04254680", "soccer_ball"], "806": ["n04254777", "sock"], "807": ["n04258138", "solar_dish"], "808": ["n04259630", "sombrero"], "809": ["n04263257", "soup_bowl"], "810": ["n04264628", "space_bar"], "811": ["n04265275", "space_heater"], "812": ["n04266014", "space_shuttle"], "813": ["n04270147", "spatula"], "814": ["n04273569", "speedboat"], "815": ["n04275548", "spider_web"], "816": ["n04277352", "spindle"], "817": ["n04285008", "sports_car"], "818": ["n04286575", "spotlight"], "819": ["n04296562", "stage"], "820": ["n04310018", "steam_locomotive"], "821": ["n04311004", "steel_arch_bridge"], "822": ["n04311174", "steel_drum"], "823": ["n04317175", "stethoscope"], "824": ["n04325704", "stole"], "825": ["n04326547", "stone_wall"], "826": ["n04328186", "stopwatch"], "827": ["n04330267", "stove"], "828": ["n04332243", "strainer"], "829": ["n04335435", "streetcar"], "830": ["n04336792", "stretcher"], "831": ["n04344873", "studio_couch"], "832": ["n04346328", "stupa"], "833": ["n04347754", "submarine"], "834": ["n04350905", "suit"], "835": ["n04355338", "sundial"], "836": ["n04355933", "sunglass"], "837": ["n04356056", "sunglasses"], "838": ["n04357314", "sunscreen"], "839": ["n04366367", "suspension_bridge"], "840": ["n04367480", "swab"], "841": ["n04370456", "sweatshirt"], "842": ["n04371430", "swimming_trunks"], "843": ["n04371774", "swing"], "844": ["n04372370", "switch"], "845": ["n04376876", "syringe"], "846": ["n04380533", "table_lamp"], "847": ["n04389033", "tank"], "848": ["n04392985", "tape_player"], "849": ["n04398044", "teapot"], "850": ["n04399382", "teddy"], "851": ["n04404412", "television"], "852": ["n04409515", "tennis_ball"], "853": ["n04417672", "thatch"], "854": ["n04418357", "theater_curtain"], "855": ["n04423845", "thimble"], "856": ["n04428191", "thresher"], "857": ["n04429376", "throne"], "858": ["n04435653", "tile_roof"], "859": ["n04442312", "toaster"], "860": ["n04443257", "tobacco_shop"], "861": ["n04447861", "toilet_seat"], "862": ["n04456115", "torch"], "863": ["n04458633", "totem_pole"], "864": ["n04461696", "tow_truck"], "865": ["n04462240", "toyshop"], "866": ["n04465501", "tractor"], "867": ["n04467665", "trailer_truck"], "868": ["n04476259", "tray"], "869": ["n04479046", "trench_coat"], "870": ["n04482393", "tricycle"], "871": ["n04483307", "trimaran"], "872": ["n04485082", "tripod"], "873": ["n04486054", "triumphal_arch"], "874": ["n04487081", "trolleybus"], "875": ["n04487394", "trombone"], "876": ["n04493381", "tub"], "877": ["n04501370", "turnstile"], "878": ["n04505470", "typewriter_keyboard"], "879": ["n04507155", "umbrella"], "880": ["n04509417", "unicycle"], "881": ["n04515003", "upright"], "882": ["n04517823", "vacuum"], "883": ["n04522168", "vase"], "884": ["n04523525", "vault"], "885": ["n04525038", "velvet"], "886": ["n04525305", "vending_machine"], "887": ["n04532106", "vestment"], "888": ["n04532670", "viaduct"], "889": ["n04536866", "violin"], "890": ["n04540053", "volleyball"], "891": ["n04542943", "waffle_iron"], "892": ["n04548280", "wall_clock"], "893": ["n04548362", "wallet"], "894": ["n04550184", "wardrobe"], "895": ["n04552348", "warplane"], "896": ["n04553703", "washbasin"], "897": ["n04554684", "washer"], "898": ["n04557648", "water_bottle"], "899": ["n04560804", "water_jug"], "900": ["n04562935", "water_tower"], "901": ["n04579145", "whiskey_jug"], "902": ["n04579432", "whistle"], "903": ["n04584207", "wig"], "904": ["n04589890", "window_screen"], "905": ["n04590129", "window_shade"], "906": ["n04591157", "Windsor_tie"], "907": ["n04591713", "wine_bottle"], "908": ["n04592741", "wing"], "909": ["n04596742", "wok"], "910": ["n04597913", "wooden_spoon"], "911": ["n04599235", "wool"], "912": ["n04604644", "worm_fence"], "913": ["n04606251", "wreck"], "914": ["n04612504", "yawl"], "915": ["n04613696", "yurt"], "916": ["n06359193", "web_site"], "917": ["n06596364", "comic_book"], "918": ["n06785654", "crossword_puzzle"], "919": ["n06794110", "street_sign"], "920": ["n06874185", "traffic_light"], "921": ["n07248320", "book_jacket"], "922": ["n07565083", "menu"], "923": ["n07579787", "plate"], "924": ["n07583066", "guacamole"], "925": ["n07584110", "consomme"], "926": ["n07590611", "hot_pot"], "927": ["n07613480", "trifle"], "928": ["n07614500", "ice_cream"], "929": ["n07615774", "ice_lolly"], "930": ["n07684084", "French_loaf"], "931": ["n07693725", "bagel"], "932": ["n07695742", "pretzel"], "933": ["n07697313", "cheeseburger"], "934": ["n07697537", "hotdog"], "935": ["n07711569", "mashed_potato"], "936": ["n07714571", "head_cabbage"], "937": ["n07714990", "broccoli"], "938": ["n07715103", "cauliflower"], "939": ["n07716358", "zucchini"], "940": ["n07716906", "spaghetti_squash"], "941": ["n07717410", "acorn_squash"], "942": ["n07717556", "butternut_squash"], "943": ["n07718472", "cucumber"], "944": ["n07718747", "artichoke"], "945": ["n07720875", "bell_pepper"], "946": ["n07730033", "cardoon"], "947": ["n07734744", "mushroom"], "948": ["n07742313", "Granny_Smith"], "949": ["n07745940", "strawberry"], "950": ["n07747607", "orange"], "951": ["n07749582", "lemon"], "952": ["n07753113", "fig"], "953": ["n07753275", "pineapple"], "954": ["n07753592", "banana"], "955": ["n07754684", "jackfruit"], "956": ["n07760859", "custard_apple"], "957": ["n07768694", "pomegranate"], "958": ["n07802026", "hay"], "959": ["n07831146", "carbonara"], "960": ["n07836838", "chocolate_sauce"], "961": ["n07860988", "dough"], "962": ["n07871810", "meat_loaf"], "963": ["n07873807", "pizza"], "964": ["n07875152", "potpie"], "965": ["n07880968", "burrito"], "966": ["n07892512", "red_wine"], "967": ["n07920052", "espresso"], "968": ["n07930864", "cup"], "969": ["n07932039", "eggnog"], "970": ["n09193705", "alp"], "971": ["n09229709", "bubble"], "972": ["n09246464", "cliff"], "973": ["n09256479", "coral_reef"], "974": ["n09288635", "geyser"], "975": ["n09332890", "lakeside"], "976": ["n09399592", "promontory"], "977": ["n09421951", "sandbar"], "978": ["n09428293", "seashore"], "979": ["n09468604", "valley"], "980": ["n09472597", "volcano"], "981": ["n09835506", "ballplayer"], "982": ["n10148035", "groom"], "983": ["n10565667", "scuba_diver"], "984": ["n11879895", "rapeseed"], "985": ["n11939491", "daisy"], "986": ["n12057211", "yellow_lady's_slipper"], "987": ["n12144580", "corn"], "988": ["n12267677", "acorn"], "989": ["n12620546", "hip"], "990": ["n12768682", "buckeye"], "991": ["n12985857", "coral_fungus"], "992": ["n12998815", "agaric"], "993": ["n13037406", "gyromitra"], "994": ["n13040303", "stinkhorn"], "995": ["n13044778", "earthstar"], "996": ["n13052670", "hen-of-the-woods"], "997": ["n13054560", "bolete"], "998": ["n13133613", "ear"], "999": ["n15075141", "toilet_tissue"]} \ No newline at end of file diff --git a/json_reclassification.py b/json_reclassification.py new file mode 100644 index 0000000..b609211 --- /dev/null +++ b/json_reclassification.py @@ -0,0 +1,30 @@ +""" +The purpose of this code is to create a custom gallery_class.json file +that contains each possible object available in the ImageNet-1000 json +file (imagenet_class_index.json) . In the gallery_class.json, each + object name is a json property with a temporary value "objects". + Once the json file is created, we will manually change the "objects" + value of each of the json properties to its corresponding category name as seen + in the "custom class.txt" file. + +""" + +import json +import os + +execution_path = os.getcwd() + +object_dictionary = {} + +with open(execution_path + "\\imagenet_class_index.json") as inputFile: + json_data = json.load(inputFile) + for aa in range(1000): + eachItem = json_data[str(aa)][1] + object_dictionary[eachItem] = "category" + +with open(execution_path + "\\gallery_class.json", "w+") as outfile: + json.dump(object_dictionary, outfile, indent=4, sort_keys=True, separators=(",", " : "), ensure_ascii=True) + outfile.close() + + + diff --git a/loading.gif b/loading.gif new file mode 100644 index 0000000..e6a0338 Binary files /dev/null and b/loading.gif differ diff --git a/logo.ico b/logo.ico new file mode 100644 index 0000000..263a854 Binary files /dev/null and b/logo.ico differ diff --git a/logo.png b/logo.png new file mode 100644 index 0000000..6e768d1 Binary files /dev/null and b/logo.png differ diff --git a/one.jpg b/one.jpg new file mode 100644 index 0000000..b51f7f2 Binary files /dev/null and b/one.jpg differ diff --git a/seven.jpg b/seven.jpg new file mode 100644 index 0000000..5573e1a Binary files /dev/null and b/seven.jpg differ diff --git a/six.jpg b/six.jpg new file mode 100644 index 0000000..67a2e21 Binary files /dev/null and b/six.jpg differ diff --git a/three.jpg b/three.jpg new file mode 100644 index 0000000..5eafec1 Binary files /dev/null and b/three.jpg differ diff --git a/two.jpg b/two.jpg new file mode 100644 index 0000000..e73ff20 Binary files /dev/null and b/two.jpg differ