1 Star 0 Fork 1

ydwang/Awesome-Deep-Learning-of-Remote-Sensing

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
resize_vgg.py 1.18 KB
一键复制 编辑 原始数据 按行查看 历史
Clark He 提交于 2020-01-18 09:22 . Reinitialize
# -*- encoding: utf-8 -*-
'''
@File : resize_vgg.py
@Contact : whut.hexin@foxmail.com
@License : (C)Copyright 2017-2018, HeXin
@Modify Time @Author @Version @Desciption
------------ ------- -------- -----------
2018/12/25 15:18 xin 1.0 None
'''
from skimage.io import imread, imsave
from skimage.transform import resize
import glob
def resize_image(input_path, save_path, file_type='tif'):
"""
图片resize,vgg输入要求224*224,故影像在输入网络之前需要resize为224*224
:param input_path: 存放输入图片文件夹
:param save_path: resize之后保存路径
:param file_type: 文件类型
:return:
"""
images = glob.glob(input_path+"/*."+file_type)
for image in images:
file_name =image[image.rindex("\\")+1:]
img = imread(image)
new_img = resize(img, (224, 224))
imsave(save_path+"/"+file_name.replace("tif", "png").replace("jpg", "png"), new_img)
if __name__ == "__main__":
input_path = r'G:\xin.data\datasets\mlw\data\validating\img'
save_path = r'G:\xin.data\datasets\mlw\data\validating\img_resize'
resize_image(input_path, save_path, "tif")
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ydwang85/Awesome-Deep-Learning-of-Remote-Sensing.git
git@gitee.com:ydwang85/Awesome-Deep-Learning-of-Remote-Sensing.git
ydwang85
Awesome-Deep-Learning-of-Remote-Sensing
Awesome-Deep-Learning-of-Remote-Sensing
master

搜索帮助