-
大小: 0.01M文件類型: .rar金幣: 1下載: 0 次發布日期: 2021-03-02
- 語言: Python
- 標簽: tensorflow??keras??CNN??
資源簡介
CNN_python程序集.rar
代碼片段和文件信息
#?-*-?coding:?utf-8?-*-
###本程序用于將.jpg格式的圖片批量轉化為.npg灰度圖像
import?os
from?PIL?import?Image
infile?=?‘./flower/‘
outfile?=?‘./flower_gray200/‘
folddirs?=?os.listdir(infile)??#用于返回指定的文件夾包含的文件或文件夾的名字的列表。
#print(folddirs)
for?foldername?in?folddirs:
????filepath?=?infile+?foldername
????filedirs?=?os.listdir(filepath)
????img_num?=?int(len(filedirs))
????filecount?=?0
????print(img_num)
????for?filename?in?filedirs:
????????img_path?=?filepath?+?‘/‘?+?filename
????????img?=?Image.open(img_path).convert(‘L‘)
????????out?=?img.resize((200200)Image.ANTIALIAS)
????????filecount?=?filecount?+?1
#???????print(filecount)
????????newfilename?=?outfile?+?foldername?+?‘/‘?+?foldername?+?str(‘_‘)+str(filecount)?+?‘.png‘
????????out.save(newfilename)
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????868??2020-03-03?20:07??CNN_python程序集\batchIM_color_to_gray.py
?????文件????????830??2020-03-09?10:50??CNN_python程序集\batch_resize_image.py
?????文件???????1257??2020-03-09?10:47??CNN_python程序集\Creat_tfrecords_Datasets.py
?????文件???????2380??2020-03-06?16:16??CNN_python程序集\Datagen_keras_cnn.py
?????文件???????5209??2020-03-09?10:42??CNN_python程序集\flower_keras_CNN.py
?????文件???????4824??2020-03-09?10:43??CNN_python程序集\flower_keras_Fconnect_NN.py
?????文件???????1328??2020-03-09?10:37??CNN_python程序集\image_gen_aug.py
?????文件???????2594??2020-03-10?16:42??CNN_python程序集\minst_tensorflow_CNN.py
?????文件???????1154??2020-03-03?19:27??CNN_python程序集\pridict_test.py
?????文件???????1799??2020-03-04?19:09??CNN_python程序集\pridict_test_mul.py
?????文件???????2097??2020-03-09?10:40??CNN_python程序集\read_data_from_TFRecords.py
?????目錄??????????0??2020-03-13?12:21??CNN_python程序集
-----------?---------??----------?-----??----
????????????????24340????????????????????12
評論
共有 條評論