Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加npy文件转成图片的脚本 #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions save_png.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
'''
tranfer the test dataset output to imgs
'''
# coding:UTF-8
from keras.preprocessing.image import array_to_img
import numpy as np


def save_output(default_dir):
'''
save test dataset into imgs into a default dir
'''

imgs_train = np.load(file= "./imgs_mask_test.npy")
imgs_train = imgs_train.astype('float32')

pictures = np.shape(imgs_train)[0]

for i in range(pictures):
img_tmp = array_to_img(imgs_train[i])
img_tmp.save(default_dir+"{}.".format(i)+"png")

if __name__ == "__main__":
default_dir = "./aoao/"
save_output(default_dir)
2 changes: 2 additions & 0 deletions unet.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import sys
sys.path.append('./')
import numpy as np
from keras.models import *
from keras.layers import Input, merge, Conv2D, MaxPooling2D, UpSampling2D, Dropout, Cropping2D
Expand Down