1. 程式人生 > >深度學習專案問題彙總(20180110更新)

深度學習專案問題彙總(20180110更新)

1. tfrecords資料轉換問題

1.1 ipython或python console使用問題

ipythonpython console中使用import 某個指令碼模組,指令碼修改後,通過reload重新載入,如再次import會有問題,否則只能重啟終端。
python3的reload在importlib中

import importlib
importlib.reload("model name")

1.2 OutOfRangeError

Caused by op 'shuffle_batch_3', defined at:
  File "/home/song/anaconda3/bin/ipython"
, line 6, in <module> sys.exit(IPython.start_ipython()) File "/home/song/anaconda3/lib/python3.5/site-packages/IPython/__init__.py", line 119, in start_ipython return launch_new_instance(argv=argv, **kwargs) File "/home/song/anaconda3/lib/python3.5/site-packages/traitlets/config/application.py", line 653
, in launch_instance app.start() ..... OutOfRangeError (see above for traceback): RandomShuffleQueue '_29_shuffle_batch_3/random_shuffle_queue' is closed and has insufficient elements (requested 1, current size 0) [[Node: shuffle_batch_3 = QueueDequeueManyV2[component_types=[DT_UINT8, DT_INT64], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/device:CPU:0"](shuffle_batch_3/random_shuffle_queue, shuffle_batch_3/n)]]

這個問題的原因有很多種,很大可能上是圖片的大小對不上

2.

2.1 測試資料轉換

import tensorflow as tf
import numpy as np
import input_cifar10

batch_size=1
traindata,trainlabel=input_cifar10.makebatch(['train_cifar10.tfrecords'],batch_size)
sess=tf.Session()
coord=tf.train.Coordinator()
threads=tf.train.start_queue_runners(sess=sess,coord=coord)
td,tl=sess.run([traindata,trainlabel])
td=tf.squeeze(td)
t=sess.run(td)
import cv2
cv2.imwrite('t.png',td)

2.2 安裝OpenCV