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

Zero matrices as synthetic outputs #30

Closed ctyeong closed 1 year ago

ctyeong commented 1 year ago

In your AgML-Synthetic.ipynb, I ran the following lines:

loader = agml.data.AgMLDataLoader.helios('tomato_sample')
_ = agml.viz.visualize_image_and_mask(loader[0])

This shows a pair of images as below, where the right seems to be correct with a segmentation result while the left is wrong with a black image.

image

I can find that loader[0][0] is simply a zero matrix because np.all(loader[0][0]==0) outputs True. I have tried this multiple times, but I always have the issue.

amogh7joshi commented 1 year ago

This might be an issue with Helios, since the example notebook generates images on my system (Mac). What platform are you running on?

amogh7joshi commented 1 year ago

@pranavraja99 @dariojavo, would you have any insight into this issue?

ctyeong commented 1 year ago

@amogh7joshi, I am running on Ubuntu18

dariojavo commented 1 year ago

Hi @ctyeong, can you please help us with the following information: 1) Was Helios correctly installed in your computer? 2) If so, please share the output of the previous step:

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

We have tested under Ubuntu 18 and 20, so it should be working. Please help us with that information in order to find out what is happening.

ctyeong commented 1 year ago

Here is the output from generator.generate(name = 'tomato_sample2', num_images = 3)

Loading XML file: /home/username/anaconda3/envs/agml/lib/python3.7/site-packages/agml/_helios/Helios/projects/SyntheticImageAnnotation/xml/style_tomato_sample2.xml...done.
Reading XML file: /home/username/anaconda3/envs/agml/lib/python3.7/site-packages/agml/_helios/Helios/projects/SyntheticImageAnnotation/xml/style_tomato_sample2.xml...Building canopy of tomato plants...done.
Ground geometry...done.
Ground consists of 100 total primitives.
done.
/home/username/.agml/synthetic/tomato_sample2/image0Rendering RGB image containing 84.82K primitives...Initializing graphics...done.
writing JPEG image: /home/username/.agml/synthetic/tomato_sample2/image0/view00000/RGB_rendering.jpeg
writing JPEG image: /home/username/.agml/synthetic/tomato_sample2/image0/view00001/RGB_rendering.jpeg
writing JPEG image: /home/username/.agml/synthetic/tomato_sample2/image0/view00002/RGB_rendering.jpeg
done.
Generating labeled image containing 2 label groups...
Initializing graphics...done.
Performing semantic segmentation for view 0... and element: 
clusters
leaves
Semantic segmentation ... done.
Performing semantic segmentation for view 1... and element: 
clusters
leaves
Semantic segmentation ... done.
Performing semantic segmentation for view 2... and element: 
clusters
leaves
Semantic segmentation ... done.
Loading XML file: /home/username/anaconda3/envs/agml/lib/python3.7/site-packages/agml/_helios/Helios/projects/SyntheticImageAnnotation/xml/style_tomato_sample2.xml...done.
Reading XML file: /home/username/anaconda3/envs/agml/lib/python3.7/site-packages/agml/_helios/Helios/projects/SyntheticImageAnnotation/xml/style_tomato_sample2.xml...Building canopy of tomato plants...done.
Ground geometry...done.
Ground consists of 100 total primitives.
done.
/home/username/.agml/synthetic/tomato_sample2/image1Rendering RGB image containing 84.484K primitives...Initializing graphics...done.
writing JPEG image: /home/username/.agml/synthetic/tomato_sample2/image1/view00000/RGB_rendering.jpeg
writing JPEG image: /home/username/.agml/synthetic/tomato_sample2/image1/view00001/RGB_rendering.jpeg
writing JPEG image: /home/username/.agml/synthetic/tomato_sample2/image1/view00002/RGB_rendering.jpeg
done.
Generating labeled image containing 2 label groups...
Initializing graphics...done.
Performing semantic segmentation for view 0... and element: 
clusters
leaves
Semantic segmentation ... done.
Performing semantic segmentation for view 1... and element: 
clusters
leaves
Semantic segmentation ... done.
Performing semantic segmentation for view 2... and element: 
clusters
leaves
Semantic segmentation ... done.
Loading XML file: /home/username/anaconda3/envs/agml/lib/python3.7/site-packages/agml/_helios/Helios/projects/SyntheticImageAnnotation/xml/style_tomato_sample2.xml...done.
Reading XML file: /home/username/anaconda3/envs/agml/lib/python3.7/site-packages/agml/_helios/Helios/projects/SyntheticImageAnnotation/xml/style_tomato_sample2.xml...Building canopy of tomato plants...done.
Ground geometry...done.
Ground consists of 100 total primitives.
done.
/home/username/.agml/synthetic/tomato_sample2/image2Rendering RGB image containing 82.02K primitives...Initializing graphics...done.
writing JPEG image: /home/username/.agml/synthetic/tomato_sample2/image2/view00000/RGB_rendering.jpeg
writing JPEG image: /home/username/.agml/synthetic/tomato_sample2/image2/view00001/RGB_rendering.jpeg
writing JPEG image: /home/username/.agml/synthetic/tomato_sample2/image2/view00002/RGB_rendering.jpeg
done.
Generating labeled image containing 2 label groups...
Initializing graphics...done.
Performing semantic segmentation for view 0... and element: 
clusters
leaves
Semantic segmentation ... done.
Performing semantic segmentation for view 1... and element: 
clusters
leaves
Semantic segmentation ... done.
Performing semantic segmentation for view 2... and element: 
clusters
leaves
Semantic segmentation ... done.
Moving Images: 100%|███████████████████| 9/9 [00:00<00:00, 13282.45it/s]
dariojavo commented 1 year ago

Seems that images are being generated correctly. Just to verify, for getting the loader you are using tomato_sample2, right? Since you are generating the dataset with that name.

loader = agml.data.AgMLDataLoader.helios('tomato_sample2')

ctyeong commented 1 year ago

@dariojavo, exactly. Of course, the result won't change with tomato_sample.

dariojavo commented 1 year ago

Yeah, of course, it should only work with the dataset that you generated. In this case tomato_sample2.

Ok, lets check the images. Can you please confirm if the images on /home/username/.agml/synthetic/tomato_sample2/... (e.g., /image2/view00000/RGB_rendering.jpeg) are not empty?

ctyeong commented 1 year ago

image0-view00000.jpeg, image0-view00001.jpeg, image0-view00002.jpeg, image1-view00000.jpeg, image1-view00001.jpeg, image1-view00002.jpeg, image2-view00000.jpeg, image2-view00001.jpeg, image2-view00002.jpeg.

These all simply look black

amogh7joshi commented 1 year ago

Can you try running generator.generate with convert_data = False, and then check whether the output images have been correctly rendered?

ctyeong commented 1 year ago

I got an error below:

FileNotFoundError: The information file at '/home/username/.agml/synthetic/tomato_sample/.metadata/agml_info.json' for the Helios dataset tomato_sample could not be found.

Under ~/.agml.synthetic/tomato_sample/, there are image0/view00000/RGB_rendering.jpeg,image0/view00001/RGB_rendering.jpeg ... `image2/view00002/RGB_rendering.jpeg. But each one is still a black image.

masonearles commented 1 year ago

Could the issue be related to the file path assuming /home/username?

On Thu, Oct 6, 2022 at 8:58 AM Taeyeong Choi @.***> wrote:

I got an error below:

FileNotFoundError: The information file at '/home/username/.agml/synthetic/tomato_sample/.metadata/agml_info.json' for the Helios dataset tomato_sample could not be found.

Under ~/.agml.synthetic/tomato_sample/, there are image0/view00000/RGB_rendering.jpeg,image0/view00001/RGB_rendering.jpeg ... `image2/view00002/RGB_rendering.jpeg. But each one is still a black image.

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

ctyeong commented 1 year ago

@masonearles I simply posted with username here, which is not my actual username on my end.

masonearles commented 1 year ago

@amogh7joshi @dariojavo Has this issue been resolved?

dariojavo commented 1 year ago

@masonearles @amogh7joshi I have checked and the error is on Helios when compiling in Ubuntu 18. I just reported this issue with Helios team.

Will keep this open until solved it.

masonearles commented 1 year ago

@dariojavo Do we have resolution on this issue?

dariojavo commented 1 year ago

Yes, this has been solved! Tested on Ubuntu 18 and 20.