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

[ ObjectNet dataset ] #2

Closed
IemProg opened this issue Jul 8, 2023 · 2 comments
Closed

[ ObjectNet dataset ] #2

IemProg opened this issue Jul 8, 2023 · 2 comments

Comments

@IemProg
Copy link

IemProg commented Jul 8, 2023

Hi,

Wonderful work, thanks for sharing the code. Could you please, share the script to split the original ObjectNet dataset into train, and test according to the filenames you provided?

Thanks !

@IemProg IemProg changed the title [ ObjectNet data ] [ ObjectNet dataset ] Jul 8, 2023
@zhoudw-zdw
Copy link
Owner

Thanks for your interest in our work.

In fact, the ObjectNet subset is sampled from the original dataset, so we suggest you download the processed data.

Anyway, if you are going to use the file list, you should download the original dataset first and then process each line of the train/test list. Within each line, you should copy it from the source directory to the target directory. We will include a Python file for processing the data upon acceptance, so please stay tuned.

@zhoudw-zdw
Copy link
Owner

Hi,

It takes some time for the paper review, while finally it has been accepted by IJCV recently. Here is the code for data split with source data and file lists.

import os
import shutil

# Define file paths
test_file = 'test.txt'
source_dir = 'images'

# Read each line from the test.txt file
with open(test_file, 'r') as file:
    lines = file.readlines()

# Process each line
for line in lines:
    # Remove newline characters and leading/trailing spaces
    line = line.strip()
    
    # Parse the target directory and file name
    parts = line.split('/')
    category = parts[-2]  # Get the directory name after the second '/', e.g., "alarm_clock"
    file_name = parts[-1]  # Get the file name, e.g., "6f4cc5da3d2d4cc.png"
    
    # Construct the source file path
    source_file = os.path.join(source_dir, category, file_name)
    
    # Construct the target directory path
    target_dir = os.path.join('.', *parts[1:-1])  # ./test/air_freshener/ or ./test/alarm_clock/
    
    # Create the target directory if it does not exist
    os.makedirs(target_dir, exist_ok=True)
    
    # Copy the file to the target directory
    shutil.copy(source_file, os.path.join(target_dir, file_name))

print("File copying completed.")

This issue was closed.
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

2 participants