简体   繁体   English

Inception v3网络(Tensorflow)中的标签错误

[英]Wrong labels in the inception v3 network (Tensorflow)

I am using build_image_data.py script from here: https://github.com/tensorflow/models/blob/master/inception/inception/data/build_image_data.py exactly like the documentation to convert my dataset to TFRecords format. 我从这里使用build_image_data.py脚本: https : //github.com/tensorflow/models/blob/master/inception/inception/inception/data/build_image_data.py就像将我的数据集转换为TFRecords格式的文档一样。 In the inception_train.py script, when I print images and labels, labels do not correspond to the images so I can't proceed to right training. 在inception_train.py脚本中,当我打印图像和标签时,标签与图像不对应,因此无法进行正确的培训。 The dataset I am using is unbalanced (different number of images between classes). 我使用的数据集不平衡(类之间的图像数量不同)。 I also made a test using the same number of images between classes and labels are still wrong. 我还使用类之间相同数量的图像进行了测试,并且标签仍然错误。 The tensorflow code is untouched, the only change I made is not applying distortions in the image_processing.py script. tensorflow代码未更改,我所做的唯一更改是未在image_processing.py脚本中应用变形。 I don't know if labels are wrong because of my TFR conversion or because of image_processing.py script which returns images and labels. 我不知道是否由于我的TFR转换或由于返回图像和标签的image_processing.py脚本而导致标签错误。 Any ideas? 有任何想法吗?

Tensorflow version: 0.10 OS: Ubuntu 14.04 Tensorflow版本:0.10操作系统:Ubuntu 14.04

The snippet of code in the inception_train.py script to check it is: inception_train.py脚本中用于检查它的代码片段为:

labs = sess.run(labels)
imgs = sess.run(images)


for i in range(FLAGS.batch_size):
  print('Label ' + str(labs[i]))
  plt.imshow(imgs[i, :, :, :])
  plt.show()

You should run both at the same time: that is, only make one call to sess.run. 您应该同时运行两个:即,仅对sess.run进行一次调用。 Something like this: 像这样:

imgs,labs = sess.run([images,labels])# ONLY ONE CALL 

for i in range(FLAGS.batch_size):
    print('Label ' + str(labs[i]))
    plt.imshow(imgs[i, :, :, :])
    plt.show()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM