0
이제 내 문제는 tfrecords를 읽는 것입니다. 예를 들어 두 개의 이미지가 있고 각 상자에 객체를 포함 할 경계 상자가 있다고 가정합니다.tensorflow로 tfrecord를 읽는 문제
image1 bbox1:xmin1,ymin1,xmax1,ymax1 image2 bbox2:xmin2,ymin2,xmax2,ymax2
데이터가 tfrecord 파일에 성공적으로 쓰여졌습니다. 이제는 내 작업이 그것을 읽는 것입니다. 나는 그것을로드 할 때
는, 나는 그것이 내가 opencv2를 사용하여 그릴이 문제를 찾으려고
`image1 bbox2:xmin2,ymin2,xmax2,ymax2`
될 수있는 데이터가 matched.For 예를하지 않습니다 찾을 수 있습니다.
tfrecord을 읽을 수있는 내 코드
은 다음과 같다 :
image, gbboxes= tf.train.batch(
[image, gbboxes],
batch_size=config.batch_size,
num_threads=1,
capacity=50)
batch_queue = slim.prefetch_queue.prefetch_queue(
[image, gbboxes],
capacity=50)
image, gbboxes = batch_queue.dequeue()
with tf.Session() as sess:
coord = tf.train.Coordinator()
threads = tf.train.start_queue_runners(sess=sess, coord=coord)
init_op = tf.global_variables_initializer()
sess.run(init_op)
# 0 index to extreact first image of batch
image = sess.run(image[0, :, :, :])
gbboxe = sess.run(gbboxes[0, :])
[ymin, xmin, ymax, xmax] = gbboxe*config.image_width
image = np.asarray(image, np.uint8)
cv2.rectangle(image, (int(xmin), int(ymin)), (int(xmax), int(ymax)), (0, 255, 0), 1)
cv2.imshow("test", image)
cv2.waitKey()
coord.request_stop()
coord.join(threads)
놀랍지 만 놀랍습니다! 대단히 감사합니다 !!! –