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

How to keep original file names #17

Open
qqaadir opened this issue Jun 2, 2020 · 3 comments
Open

How to keep original file names #17

qqaadir opened this issue Jun 2, 2020 · 3 comments

Comments

@qqaadir
Copy link

qqaadir commented Jun 2, 2020

Dear @lozuwa

This is a great work. I have created new reduced images and annotations successfully. I am wondering is there a way to keep original files name instead of assigning new names. I have the following code

def main():
    images_path = os.path.join(os.getcwd(), "images")
    annotations_path = os.path.join(os.getcwd(), "Annotation")
    # Define the name of the dataset
    dbName = "CarsDataset"
	# Create an object of ObjectDetectionDataset
    obda = ObjectDetectionDataset(imagesDirectory=images_path, annotationsDirectory=annotations_path, databaseName = dbName)
	# Reduce the dataset to smaller Rois of smaller ROIs of shape 1092 x 1080.
    offset=[480, 360]
    images_output_path = os.path.join(os.getcwd(), "images_reduced")
    annotations_output_path = os.path.join(os.getcwd(), "Annotation_reduced")
    obda.reduceDatasetByRois(offset = offset, outputImageDirectory = images_output_path, outputAnnotationDirectory = annotations_output_path)

if __name__ == "__main__":
	main()

this code append CarsDataset at the start of each image and it assigns some ids to each image. What I want is to keep original image names, for example if my file name is image_1 and your library create four crops, I want to name those crops as image_1_1, .... images_1_4. Thank you for your suggestions.

@baicaigithub
Copy link

This fork has the feature you need.
https://github.com/baicaigithub/impy

@qqaadir
Copy link
Author

qqaadir commented Aug 16, 2020

@baicaigithub Could please you give an example on how your fork retains filenames? I checked your link, the example provided is still the same as on the original page. Thank you.

@baicaigithub
Copy link

I only hacked a few places to keep the original names. Didn't update the doc.

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