第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在Tensorflow中進行圖像處理的黑色輸出(使用jpeg解碼器進行神經(jīng)網(wǎng)絡(luò)訓(xùn)練)

在Tensorflow中進行圖像處理的黑色輸出(使用jpeg解碼器進行神經(jīng)網(wǎng)絡(luò)訓(xùn)練)

慕碼人8056858 2021-04-08 14:15:47
我可以訪問大量以TFRecords二進制格式存儲的2048x2048x3 jpeg圖片。后來,我使用存儲的文件來訓(xùn)練深度神經(jīng)網(wǎng)絡(luò)。為了存儲圖片,我目前使用兩種不同的方法。第一個使用張量流。我定義了一個創(chuàng)建Tensorflow圖的函數(shù)。我一直在為所有圖片重復(fù)使用相同的圖形:def picture_decoder(height, width):    g = tf.Graph()    with g.as_default():        picture_name_tensor = tf.placeholder(tf.string)        picture_contents = tf.read_file(picture_name_tensor)        picture = tf.image.decode_jpeg(picture_contents)        picture_as_float = tf.image.convert_image_dtype(picture, tf.float32)        picture_4d = tf.expand_dims(picture_as_float, 0)        resize_shape = tf.stack([height, width])        resize_shape_as_int = tf.cast(resize_shape, dtype=tf.int32)        final_tensor =  tf.image.resize_bilinear(picture_4d, resize_shape_as_int)    return g, picture_name_tensor, final_tensorHeight, Width = 300, 300graph, nameholder, image_tensor = picture_decoder(Height, Width)                                        with tf.Session(graph=graph) as sess:    init = tf.group( tf.global_variables_initializer(), tf.local_variables_initializer() )    sess.run(init)    #Loop through the  pictures    for(...picture_name...):        picture = sess.run(image_tensor, feed_dict={nameholder: picture_name} )    第二種方法使用numpy:def picture_decoder_numpy(picture_name, height, width):    image = Image.open(picture_name)    image = image.resize((height,width), Image.LANCZOS)    image = np.array(image, dtype=np.int32)                                 return np.expand_dims(image, axis=0)Heigth, Width = 300, 300for(...picture_name...):    picture = picture_decoder_numpy(pict, Height, Width)第一種方法似乎比第二種方法快約6倍。我面臨的問題與以后的培訓(xùn)有關(guān)。對于第一種情況,我定義的深度神經(jīng)網(wǎng)絡(luò)無法學(xué)習(xí),即,其損失在許多時期內(nèi)都沒有改善,并且僅比1小一點。使用第二種方法,在不更改任何神經(jīng)網(wǎng)絡(luò)參數(shù)的情況下,損失達到了E-05值。我是否缺少一些Tensorflow細(xì)節(jié)?如有必要,我可以發(fā)布完整的代碼。
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 309 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號