mirror of
https://github.com/open-mmlab/mmsegmentation.git
synced 2025-06-03 22:03:48 +08:00
[fix] fix image save path bug in Windows (#1423)
* [fix] fix image save path bug in Windows * fix lint error
This commit is contained in:
parent
28488851fd
commit
da8b79b4da
@ -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)
|
||||
@ -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)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user