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

Unable to visualize images in Data_Viz notebook #5

Open
sparshgarg23 opened this issue Dec 7, 2023 · 0 comments
Open

Unable to visualize images in Data_Viz notebook #5

sparshgarg23 opened this issue Dec 7, 2023 · 0 comments

Comments

@sparshgarg23
Copy link

I was going through your repository to understand visualization of data in ETCI20201 competition.And I have few queries
1.On executing the cells related to downloading the data,when i execute the below code the number of image paths comes out to be 66812.But in your text cell,the number of images is 33406.Any reason why this is happening?

all_image_paths = list(paths.list_images("train"))
print(f"Total images: {int(len(all_image_paths)/2)}")

Secondly,on executing the below code in the data_viz notebook

def show_all_four_images(filenames, titles):
    plt.figure(figsize=(20, 10))
    images = []
    for filename in filenames:
        images.append(mpimg.imread(filename))
        
    plt.suptitle(get_image_id(filenames[0]), size=16)
    columns = 4
    
    for i, image in enumerate(images):
        ax = plt.subplot(len(images)/ columns + 1, columns, i + 1)
        ax.set_title(titles[i])
        plt.imshow(image)

    plt.show()
`
import random

titles = ["V V","V H" , "Land or water before flood/Water body image" ,"After Flood/flood image"]

random_index =  random.sample(range(0, len(vv_image_paths)), 10) 
for i in random_index:
    # The assertions make sure we are operating on the right pairs
    assert  get_intensity(vv_image_paths[i]) == get_intensity(flood_image_paths[i])
    assert  get_intensity(vh_image_paths[i]) == get_intensity(water_body_label_paths[i])
    show_all_four_images([vv_image_paths[i], vh_image_paths[i],  
                          water_body_label_paths[i], flood_image_paths[i] ] , titles  throws exception error 

Using random indices when you call show_all_four_images,the following error is encountered

Number of rows must be positive integer not 2.0 
the exception is raised in show_alL_four_images when you run ax.subplot(len(images)/columns+1,columns,i+1)

The issue can be resolved when I convert it to int,but then the visualization is not good.
As such,I feel that there is some issues in the all_image_path section,because the number of images must be 33406 according to torch-rs but when I execute your code it comes out to be 4 times that amount.
thanks

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

1 participant