1. 程式人生 > >TensorFlow time模組

TensorFlow time模組

import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import time
img_read=tf.gfile.FastGFile('F:\AA\youlishentanti_resize\Atwo_23.jpg','rb').read()
with tf.Session() as sess:
    start_time=time.time()
    img_decode=tf.image.decode_png(img_read)
    plt.imshow(img_decode.eval())
    plt.title('yuantu',fontsize=20)
    plt.show()
    resized=tf.image.resize_images(img_decode,[128,128],method=0)
    resized=np.asarray(resized.eval(),dtype='uint8')
    plt.title('jietu',fontsize=20)
    plt.imshow(resized)
    plt.show()
    duration=time.time()-start_time
    print(duration)
    resized=tf.image.encode_png(resized)
    with tf.gfile.GFile('F:\AA\AoneAtwo\Atwo1\A2-2123.jpg','wb') as f:
        f.write(resized.eval())
 

相關推薦

TensorFlow time模組

import tensorflow as tf import numpy as np import matplotlib.pyplot as plt import time img_read=tf.gfile.FastGFile('F:\AA\youlishentanti_r

量化交易入門筆記-Datetime和Time模組

Python 中,通常有三種方式用來表示時間,分別是時間戳、格式化的字串、元組(struct_time)方式 時間戳 一般來講,時間戳表示的是從1970年1月1日00:00:00開始按秒計算的偏移量。可以運用"type(time.time())",返回的是 float 。

python~time模組詳解

time模組  在開始之前,首先要說明這幾點:     在Python中,通常有這幾種方式來表示時間:1)時間戳 2)格式化的時間字串 3)元組(struct_time)共九個元素。由於Python的time模組實現主要呼叫C庫,所以各個

random模組 time模組的用法 python

1.random()模組的使用 import random x = random.random() y = random.random() print(x,y*10) #random.random()隨機生成一個[0,1)之間的隨機數 m = random.randint(0,10) print

python time模組總結

    常用函式: import time --------------------------------------------------time.time()                    &

time模組,random模組,OS模組,sys模組

time模組 時間展示 import time #匯入模組 print(time.time()) #時間戳時間 print(time.strftime('%Y-%m-%d %x')) #字串格式化時間 print(time.strftime('%Y-%m-%d

time模組-時間相關模組

和時間有關係的我們就要用到時間模組。在使用模組之前,應該首先匯入這個模組。 #常用方法 1.time.sleep(secs) (執行緒)推遲指定的時間執行。單位為秒。 2.time.time() 獲取當前時間戳   表示時間的三種方式 在Python中,通常有這三種方式來表示時間:

爬蟲3-time模組和代理

爬蟲對資訊的訪問速度高出常人很多,所以伺服器如果監測到速度超過一個固定的閾值,就會讓使用者輸入驗證碼,所以要限制訪問速度,方法有兩個 第一,利用time模組 import urllib.request import urllib.parse import jsonimport timewhi

【Python程式設計】自由管理時間之time模組

Python_自由管理時間 程式設計中時間的使用場景 檔案屬性 資料庫 頁面UI顯示 定時 日誌 一、時間戳 1.1、時間戳相關的概念 時間戳是指格林威治時間1970年01月01日00時00分00秒(北京時間1970年01月

time模組的常見應用

程式碼示例: import time print("time.time(): %s" % time.time()) print("time.ctime():%s" % time.ctime(3)) localtime1 = time.localtime(1455508609.3473

Python基礎(四)--- Python多執行緒介紹,開啟執行緒的三種方式,time模組,join,Daemon,Lock、Rlock,事件機制,Timer

一、多執行緒介紹 --------------------------------------------------------- 1.threading用於提供執行緒相關的操作,執行緒是應用程式中工作的最小單元。 2.python當前版本的多執行緒庫沒有實現優先順序、執行緒組,執

常用模組time模組

import time #獲取當前的時間戳 浮點型 floatStamp = time.time() print(floatStamp) #獲取當前的時間戳 整型 intStamp = int(time.time()) print(intStamp) #從返回的浮點數的時間戳轉成時間元組 loca

datetime模組time模組

pyhton的datetime模組分析(小女子的測試之路):https://www.cnblogs.com/cindy-cindy/p/6720196.html python時間模組小結(time and datetime):https://www.cnblogs.com/sunshineyang/p/68

time 模組的時間轉換

time.localtime(timetamp) 返回當地時間的時間元祖 time.gmtime(timetamp) 返回格林威治時間的時間元祖 夏令時和冬令時:一些國家為了調整時間而規定在某一天將時間調快或調慢一些,用以保證而作日落而歸。要不然早上4,5點的時候太陽就出來了多尷尬。比如某

人生中第一篇部落格——Tensorflow.hub模組的應用圖片分類的重訓練(源於文件原始碼)

1. tf.gfile.LIstDirectory(filename) 返回資料夾(filename)的列表,類似於listdir,子資料夾只會返回資料夾名。 2. tf.image.decode_jpeg(jpeg_data,channels = depth) jpeg_data = tf.

【python】詳解time模組功能asctime、localtime、mktime、sleep、strptime、strftime、time等函式以及時間的加減運算

在Python中,與時間處理相關的模組有:time、datetime以及calendar。學會計算時間,對程式的調優非常重要,可以在程式中狂打時間戳,來具體判斷程式中哪一塊耗時最多,從而找到程式調優的重心處。這裡先來講一個time模組。 time模組所包含的函式能夠實現以下功能:獲取當前的時間、操作時間和日

time 模組處理時間資料格式的幾種方式

time 模組中處理時間資料格式的幾種方式 在 time 模組中,時間資料主要有三種格式:時間戳(timeStamp)、時間陣列(timeStruct)和時間字串(timeStr)。形式如下圖所示: 對於這三種格式的資料,時間戳與時間陣列之間可以互相轉換,時間陣列和時間字串之間可以互相

tensorflow layers模組操作

tf.layers模組提供的方法有: input(...): 例項化一個輸入Tensor,作為一個神經網路的輸入 average_pooling1d(...): 一維平均池化層 average_pooling2d(...): 二維平均池化層 average_pooli

孤荷凌寒自學python第二十六天python的time模組的相關方法

孤荷凌寒自學python第二十六天python的time模組的相關方法   (完整學習過程螢幕記錄視訊地址在文末,手寫筆記在文末) 要使用time模組的相關方法,必須在檔案頂端引用: import time   1 將時間戳(timeStamp)轉換成標準時間元

python進階(time模組

    一、時間戳與元組時間: import time # 時間戳 與 元組時間 時間戳轉化為元組時間 print(time.time()) # 1542594772.0971806