Skip to content

Unable to visualize images in Data_Viz notebook #5

@sparshgarg23

Description

@sparshgarg23

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions