InsightFace_TF icon indicating copy to clipboard operation
InsightFace_TF copied to clipboard

tran.tfrecords not found error

Open jimmy3456 opened this issue 7 years ago • 13 comments

Hi, sir When run "train_nets.py" , I get the following errors:

2018-06-11 16:48:15.835525: W tensorflow/core/framework/allocator.cc:101] Allocation of 174415872 exceeds 10% of system memory. 2018-06-11 16:48:15.836087: W tensorflow/core/framework/allocator.cc:101] Allocation of 174415872 exceeds 10% of system memory. 2018-06-11 16:48:24.161151: W tensorflow/core/framework/allocator.cc:101] Allocation of 174415872 exceeds 10% of system memory. Traceback (most recent call last): File "/home/jimmy/anaconda3/envs/mlwork/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1322, in _do_call return fn(*args) File "/home/jimmy/anaconda3/envs/mlwork/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1307, in _run_fn options, feed_dict, fetch_list, target_list, run_metadata) File "/home/jimmy/anaconda3/envs/mlwork/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1409, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.NotFoundError: ./datasets/tfrecords/tran.tfrecords; No such file or directory [[Node: IteratorGetNext = IteratorGetNextoutput_shapes=[[?,112,112,3], [?]], output_types=[DT_FLOAT, DT_INT64], _device="/job:localhost/replica:0/task:0/device:CPU:0"]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "train_nets.py", line 167, in images_train, labels_train = sess.run(next_element) File "/home/jimmy/anaconda3/envs/mlwork/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 900, in run run_metadata_ptr) File "/home/jimmy/anaconda3/envs/mlwork/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1135, in _run feed_dict_tensor, options, run_metadata) File "/home/jimmy/anaconda3/envs/mlwork/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1316, in _do_run run_metadata) File "/home/jimmy/anaconda3/envs/mlwork/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1335, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.NotFoundError: ./datasets/tfrecords/tran.tfrecords; No such file or directory [[Node: IteratorGetNext = IteratorGetNextoutput_shapes=[[?,112,112,3], [?]], output_types=[DT_FLOAT, DT_INT64], _device="/job:localhost/replica:0/task:0/device:CPU:0"]]

Caused by op 'IteratorGetNext', defined at: File "train_nets.py", line 65, in next_element = iterator.get_next() File "/home/jimmy/anaconda3/envs/mlwork/lib/python3.6/site-packages/tensorflow/python/data/ops/iterator_ops.py", line 370, in get_next name=name)), self._output_types, File "/home/jimmy/anaconda3/envs/mlwork/lib/python3.6/site-packages/tensorflow/python/ops/gen_dataset_ops.py", line 1466, in iterator_get_next output_shapes=output_shapes, name=name) File "/home/jimmy/anaconda3/envs/mlwork/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "/home/jimmy/anaconda3/envs/mlwork/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3392, in create_op op_def=op_def) File "/home/jimmy/anaconda3/envs/mlwork/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1718, in init self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

NotFoundError (see above for traceback): ./datasets/tfrecords/tran.tfrecords; No such file or directory [[Node: IteratorGetNext = IteratorGetNextoutput_shapes=[[?,112,112,3], [?]], output_types=[DT_FLOAT, DT_INT64], _device="/job:localhost/replica:0/task:0/device:CPU:0"]]

Where I can get "tran.tfrecords" ? Thank you. Jimmy

jimmy3456 avatar Jun 11 '18 08:06 jimmy3456

Read the function named mx2tfrecords at ./data/mx2tfrecords/, and 'main' part in the same file shows its invoking process. You need to download the origin dataset (see: https://github.com/deepinsight/insightface), then try to use function mx2tfrecords to convert train.rec and train.idx to tran.tfrecords.

david-di avatar Jul 13 '18 12:07 david-di

hi, David Thank you, it works for me

jimmy3456 avatar Jul 17 '18 03:07 jimmy3456

@jimmy3456 Hello, I have encountered the same problem. Can you tell me how to solve it? thank you very much.

WJSAI avatar Jul 22 '18 09:07 WJSAI

hi WJSAI

As David said, you have to download the origin dataset first then modify the main part of "mx2tfrecords.py" at ./data/mx2tfrecords/ Here is my modify part at mx2tfrecords.py : if name == 'main': # # define parameters id2range = {} data_shape = (3, 112, 112) args = parse_args() imgrec = mx.recordio.MXIndexedRecordIO(args.idx_path, args.bin_path, 'r') s = imgrec.read_idx(0) header, _ = mx.recordio.unpack(s) print(header.label) imgidx = list(range(1, int(header.label[0]))) seq_identity = range(int(header.label[0]), int(header.label[1])) for identity in seq_identity: s = imgrec.read_idx(identity) header, _ = mx.recordio.unpack(s) a, b = int(header.label[0]), int(header.label[1]) id2range[identity] = (a, b) print('id2range', len(id2range))

# # generate tfrecords
mx2tfrecords(imgidx, imgrec, args)

#config = tf.ConfigProto(allow_soft_placement=True)
#sess = tf.Session(config=config)
# training datasets api config
#tfrecords_f = os.path.join(args.tfrecords_file_path, 'tran.tfrecords')
#dataset = tf.data.TFRecordDataset(tfrecords_f)
#dataset = dataset.map(parse_function)
#dataset = dataset.shuffle(buffer_size=30000)
#dataset = dataset.batch(32)
#iterator = dataset.make_initializable_iterator()
#next_element = iterator.get_next()
# begin iteration
#for i in range(1000):
#    sess.run(iterator.initializer)
#    while True:
#        try:
#            images, labels = sess.run(next_element)
#            cv2.imshow('test', images[1, ...])
#            cv2.waitKey(0)
#        except tf.errors.OutOfRangeError:
#            print("End of dataset")

hope this would help you

jimmy3456 avatar Jul 23 '18 01:07 jimmy3456

@jimmy3456 hi, jimmy3456 Thank you, it works for me

WJSAI avatar Jul 23 '18 08:07 WJSAI

Hi David when i run the following code import tensorflow as tf image=tf.image.decode_jpeg(tf.read_file("images/test.jpg")) sess=tf.Session() print(sess.run(image))

then this error show please tell me that how i fix it errorr

muneebullahkhan avatar Aug 11 '18 08:08 muneebullahkhan

@muneebullahkhan I guess you are using ipython. Maybe you need to check whether the path 'image/test.jpg' is consistent with your workdir. At least, I don't think there is any mistake in your code.

david-di avatar Aug 11 '18 13:08 david-di

Hi @david-di when i try to use function mx2tfrecords to convert train.rec and train.idx to tran.tfrecords like jimmy @jimmy3456 then this error show: image

can you tell me that how i fix it? Any help will be grateful! thanks!

SunnyWangGitHub avatar Aug 22 '18 07:08 SunnyWangGitHub

Thanks david-di my error is slove

muneebullahkhan avatar Sep 09 '18 17:09 muneebullahkhan

Thanks for the advice. And could you tell me more details about the “modifiy" . Is the code in the top modified and is the code in the down commented? Or simply give the complete code. Thanks a lot.

Crisfw avatar Oct 17 '18 07:10 Crisfw

@jimmy3456

Crisfw avatar Oct 17 '18 07:10 Crisfw

Hi @david-di the error below occurred. 屏幕快照 2019-04-04 下午5 30 45 Here is the code: 屏幕快照 2019-04-04 下午5 32 51

TengliEd avatar Apr 04 '19 09:04 TengliEd

Hi @david-di the error below occurred. 屏幕快照 2019-04-04 下午5 30 45 Here is the code: 屏幕快照 2019-04-04 下午5 32 51

i find head.label is a 1*2 array ,so i take the first number as the label(i guess,) ,then the error will disappear ,but when i run train_nets.py it will stuck at Shuffle buffer filled

zfs1993 avatar May 23 '19 08:05 zfs1993