Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can i download the images as per the categories? #61

Open
hardikchauhan8 opened this issue Jan 10, 2018 · 5 comments
Open

Can i download the images as per the categories? #61

hardikchauhan8 opened this issue Jan 10, 2018 · 5 comments

Comments

@hardikchauhan8
Copy link

I want dataset of images with Cars, Traffic signals, and pedestrian signals,
Is there any options to download images dataset of only this class?

@Nachwa
Copy link

Nachwa commented Mar 6, 2018

I did a small script using the bbox_hierarchy.json file from dendrogram
You can download the file from here

import json
class_hierarchy_path = './data/classes/bbox_hierarchy.json'
with open(class_hierarchy_path, 'r') as file:
    class_hierarchy = json.load(file)
    
def find_children(json_input, keyword):
    
    if isinstance(json_input, dict):
        for k, v in json_input.items():
            if  k =='name' and v == keyword:
                print('search in children of', v)
                keywords.update([keyword])
                if 'children' in json_input:
                    find_children(json_input['children'], keyword=next(studied_class))
            elif k =='name' and keyword == '*':
                    keywords.update([v])                    
                    if 'children' in json_input:
                        find_children(json_input['children'], keyword=keyword)  
            
    elif isinstance(json_input, list):
        for json_item in  json_input:
            find_children(json_item, keyword)

Then you can write some paths from the dendrogram. Examples:

categories = ['Entity.Vehicle.Land vehicle.Car.*',
              'Entity.Outdoor.Street items.*'
             ]

keywords = set()
for category in categories:
    studied_class = iter(category.split('.'))
    #assert class_hierarchy['name'] == next(studied_class), 'the root class is "Entity"'
    find_children(class_hierarchy, next(studied_class))
print('Found keywords are : ', keywords)

Those keywords can be replaces with trainable_classes_path in code of deepdive5 which I used to download images.

@MostafaEmam95
Copy link

Any Solution to download only needed classes ?

@keldrom
Copy link

keldrom commented Jul 28, 2018

https://github.com/EscVM/OIDv4_ToolKit

@cyrineee
Copy link

cyrineee commented Mar 5, 2019

how can i use data augmentation on open images v4 for some classes ?

@Jarmos-san
Copy link

@cyrineee I guess you should search StackOverflow for the answer & replies to this thread shouldn't be derailed. Besides, I guess the thread should be closed as @keldrom's reply appears to work perfectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants