User2010
User2010

Reputation: 11

Why do the supposed super resolution images from SRGAN appear in RGB colors?

I am using this srgan script to try to generate super resolution satellite images. A few things I modified are input images, shapes and saving images. Anyone understands why the images generated looks like: this.

Also, why are the rgb pixels each assigned a value of 1 and the other colors getting zero point something? The range of the input datasets is between 0 and 0.6 for all images.

loading low resolution images:
s2_image = []
def load_s2_images(s2):
    for file in os.listdir(s2):
        if file.endswith('.TIF'):
            file_path = os.path.join(s2, file)

            dataset = gdal.Open(file_path, gdalconst.GA_ReadOnly)
            red = dataset.GetRasterBand(4).ReadAsArray()
            green = dataset.GetRasterBand(3).ReadAsArray()
            blue = dataset.GetRasterBand(2).ReadAsArray()
            # coastal = dataset.GetRasterBand(1).ReadAsArray()
            # nir = dataset.GetRasterBand(8).ReadAsArray()
            # redEg = dataset.GetRasterBand(5).ReadAsArray()

            s2_nparray = np.stack((red, green, blue), axis=-1)#, coastal, nir, redEg), axis=-1)

            s2_image.append(s2_nparray)
            
    return s2_image
            
s2_image_arrays = load_s2_images(s2)

saving images

def save_generated_images(epoch, generator_model, s2_test, output_dir):
    generated_sr_images = generator_model.predict(s2_test)
    for ni, image in enumerate(generated_sr_images):
        plt.imsave(f"{output_dir}/epoch_{epoch}_image_{i}.png", image)

I split all images into 32*32, and I was expecting that when I load them into arcgis, they are next to each other instead of overlaying on top of each other. If it helps, I tested both on the pretained imagenet model and the VGG from scratch.

Upvotes: 0

Views: 47

Answers (0)

Related Questions