Project-AgML / AgML

AgML is a centralized framework for agricultural machine learning. AgML provides access to public agricultural datasets for common agricultural deep learning tasks, with standard benchmarks and pretrained models, as well the ability to generate synthetic data and annotations.
Apache License 2.0
167 stars 28 forks source link

Changing the paths of saved synthetic images #40

Closed ctyeong closed 1 year ago

ctyeong commented 1 year ago

I would like to generate synthetic images under a certain directory (e.g., './syn_data'). I have tried using:

agml.backend.set_synthetic_save_path('./syn_data') before generation, but it still saves to ~/.agml/synthetic. Is there any particular way of using it properly?

masonearles commented 1 year ago

@amogh7joshi Can you help with this?

amogh7joshi commented 1 year ago

That's weird, and might need a bugfix. However, when using the HeliosDataGenerator, you can use the output_dir argument in the generate method to set an output directory.

ctyeong commented 1 year ago

@amogh7joshi I have gotten an error from the output_dir argument. I have run your synthetic example like this:

# Construct the data generator.
generator = agml.synthetic.HeliosDataGenerator(opt)

# Generate the data.
generator.generate(name = 'tomato_sample', num_images = 3, output_dir='./output_dir') 

The error below then follows:

FileNotFoundError: [Errno 2] No such file or directory: '/home/username/anaconda3/envs/agml/lib/python3.8/site-packages/agml/_helios/Helios/projects/SyntheticImageAnnotation/./output_dir/tomato_sample/.metadata/config_tomato_sample.txt'
masonearles commented 1 year ago

It could be a path issue. Does the path above exist on your machine?

On Fri, Jan 27, 2023 at 10:36 AM Taeyeong Choi @.***> wrote:

@amogh7joshi https://github.com/amogh7joshi I have gotten an error from the output_dir argument. I have run your synthetic example like this:

Construct the data generator.

generator = agml.synthetic.HeliosDataGenerator(opt)

Generate the data.

generator.generate(name = 'tomato_sample', num_images = 3, output_dir='./output_dir')

The error below then follows:

FileNotFoundError: [Errno 2] No such file or directory: '/home/username/anaconda3/envs/agml/lib/python3.8/site-packages/agml/_helios/Helios/projects/SyntheticImageAnnotation/./output_dir/tomato_sample/.metadata/config_tomato_sample.txt'

— Reply to this email directly, view it on GitHub https://github.com/Project-AgML/AgML/issues/40#issuecomment-1406927948, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG5FGPEJFZ3J4LVTH35SJGDWUQIRNANCNFSM6AAAAAAUIALYN4 . You are receiving this because you commented.Message ID: @.***>

ctyeong commented 1 year ago

Yes. ./output_dir/tomato_sample/ has been created automatically, but I think .metadata is not there.

dariojavo commented 1 year ago

Hi Taeyeong,

Seems to be a path issue. I just tried and it worked. Could you specified a different path (that exists) in output_dir. For example:

generator.generate(name = 'tomato_sample', num_images = 1, output_dir='/home/dariojavo/Documents/example')