Skip to content

Commit

Permalink
[fix] fix image save path bug in Windows (open-mmlab#1423)
Browse files Browse the repository at this point in the history
* [fix] fix image save path bug in Windows

* fix lint error
  • Loading branch information
whu-pzhang authored and mob5566 committed Apr 13, 2022
1 parent 271bd8b commit f06944d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tools/convert_datasets/isaid.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ def slide_crop_image(src_path, out_dir, mode, patch_H, patch_W, overlap):

img_patch = img[y_str:y_end, x_str:x_end, :]
img_patch = Image.fromarray(img_patch.astype(np.uint8))
image = osp.splitext(
src_path.split('/')[-1])[0] + '_' + str(y_str) + '_' + str(
y_end) + '_' + str(x_str) + '_' + str(x_end) + '.png'
image = osp.basename(src_path).split('.')[0] + '_' + str(
y_str) + '_' + str(y_end) + '_' + str(x_str) + '_' + str(
x_end) + '.png'
# print(image)
save_path_image = osp.join(out_dir, 'img_dir', mode, str(image))
img_patch.save(save_path_image)
Expand Down Expand Up @@ -135,7 +135,7 @@ def slide_crop_label(src_path, out_dir, mode, patch_H, patch_W, overlap):
lab_patch = label[y_str:y_end, x_str:x_end]
lab_patch = Image.fromarray(lab_patch.astype(np.uint8), mode='P')

image = osp.splitext(src_path.split('/')[-1])[0].split(
image = osp.basename(src_path).split('.')[0].split(
'_')[0] + '_' + str(y_str) + '_' + str(y_end) + '_' + str(
x_str) + '_' + str(x_end) + '_instance_color_RGB' + '.png'
lab_patch.save(osp.join(out_dir, 'ann_dir', mode, str(image)))
Expand Down

0 comments on commit f06944d

Please sign in to comment.