Fixes an issue in isaid.py (#3010)

## Motivation

When processing data in the isaid experiment, generated images only have
binary pixel values of 0 or 1 instead of the corresponding class values.
This causes significant interference and prevents subsequent experiments
from proceeding. After investigation, it was found that the issue was
caused by using the wrong image format for saving the images. Saving the
images as PNG resulted in binary pixel values, while saving the images
as BMP resolved the issue and correctly saved the class values.

## Modification

`img_patch.save(save_path_image, format='BMP')`

This code will save the image data as BMP format.

## BC-breaking 

Confirm that the modification does not introduce new issues and test
that the modified code successfully resolves the original problem.

---------

Co-authored-by: 谢昕辰 <xiexinch@outlook.com>
Co-authored-by: CSH <40987381+csatsurnh@users.noreply.github.com>
This commit is contained in:
Kedreamix 2023-05-30 14:44:05 +08:00 committed by GitHub
parent 5563480e70
commit b6ec4ab1e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -91,7 +91,7 @@ def slide_crop_image(src_path, out_dir, mode, patch_H, patch_W, overlap):
x_end) + '.png'
# print(image)
save_path_image = osp.join(out_dir, 'img_dir', mode, str(image))
img_patch.save(save_path_image)
img_patch.save(save_path_image, format='BMP')
def slide_crop_label(src_path, out_dir, mode, patch_H, patch_W, overlap):