Closed MartinThoma closed 8 years ago
I think it might be this problem: http://stackoverflow.com/a/33775312/562769
build_training_graph
gibt
({'train': <tensorflow.python.ops.data_flow_ops.FIFOQueue object at 0x7fdaa966b810>,
'val': <tensorflow.python.ops.data_flow_ops.FIFOQueue object at 0x7fdaa795c810>},
<tensorflow.python.framework.ops.Operation object at 0x7fdaa88b9f90>,
<tf.Tensor 'loss/total_loss:0' shape=() dtype=float32>,
{'train': None, 'val': None})
zurück
AP5/model/objective.py
: evaluation gibt immer None
zurück.
Are you using TensorVision @ fee9114
? Commit fee9114 contains a patch to handle the case of None
as return value for evaluation. I have not merged this patch/feature into main TensorVision.
Alternatively you can remove line: AP5/model/objective.py:81
. This will slow the training process but increase the evaluation done. (Which might be beneficial in your case). I am not able to test the code here. But both solutions should work.
I dowloaded fee9114 as a zip (because checking it out was not possible). Now I get:
2016-07-05 16:41:57,531 INFO Step 0/1000: loss = 1.10 ( 0.095 sec (per Batch); 10.5 examples/sec)
2016-07-05 16:44:05,930 INFO Step 50/1000: loss = 1.10 ( 2.509 sec (per Batch); 0.4 examples/sec)
2016-07-05 16:45:57,487 INFO Step 100/1000: loss = 0.51 ( 2.190 sec (per Batch); 0.5 examples/sec)
2016-07-05 16:47:33,242 INFO Step 150/1000: loss = 0.52 ( 1.878 sec (per Batch); 0.5 examples/sec)
2016-07-05 16:49:07,895 INFO Step 200/1000: loss = 0.76 ( 1.856 sec (per Batch); 0.5 examples/sec)
2016-07-05 16:50:35,459 INFO Doing Evaluate with Training Data.
2016-07-05 16:50:35,460 INFO Doing Evaluation with Testing Data.
2016-07-05 16:50:35,460 INFO Doing Python Evaluation.
Traceback (most recent call last):
File "train.py", line 76, in <module>
tf.app.run()
File "/home/moose/.local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 30, in run
sys.exit(main(sys.argv))
File "train.py", line 72, in main
train.do_training(hypes)
File "/home/moose/GitHub/private/MediSeg/AP5/tensorvision/train.py", line 393, in do_training
image_pl, softmax)
File "/home/moose/GitHub/private/MediSeg/AP5/tensorvision/train.py", line 326, in run_training_step
image_pl, softmax)
File "/home/moose/GitHub/private/MediSeg/AP5/tensorvision/train.py", line 294, in _do_python_evaluation
eval_dict, images = objective.tensor_eval(hypes, sess, image_pl, softmax)
File "/home/moose/GitHub/private/MediSeg/AP5/hypes/../model/objective.py", line 155, in tensor_eval
FN, FP, posNum, negNum = eval_image(hypes, gt_image, output_im)
File "/home/moose/GitHub/private/MediSeg/AP5/hypes/../model/objective.py", line 115, in eval_image
validArea=None)
File "/home/moose/GitHub/private/MediSeg/AP5/utils/kitti_devkit/seg_utils.py", line 53, in evalExp
assert len(gtBin.shape) == 2, 'Wrong size of input prob map'
AssertionError: Wrong size of input prob map
gtBin.shape
is (480, 640, 4)
in that case.
Ok, I think I might have found the problem. In tensor_eval
you should flatten the image:
gt_image = scp.misc.imread(gt_file, flatten=True)
However, this makes it obvious that I should work on https://github.com/TensorVision/TensorVision/issues/42 so that we can have a much cleaner approach :-)
edit: Yes, it works :-)
Ok, turned out that fixing this was as easy as updating the submodule TensorVision
to head of python_eval
.
@MartinThoma In my runs gt_image
always has shape (480, 640)
, i.e.gt_image
is loaded as greyscale image. Do you have a different/older scipy version? And why should https://github.com/TensorVision/TensorVision/issues/42 fix this? Are you planning to implement checks, testing whether gt is always loaded as greyscale?
Ah, the difference might be that I edited the labels to be white / black instead of those three grayscale values (2 for instruments). That changed the color mode to RGB.
Do you have a different/older scipy version?
Unlikely. My scipy.__version__
is 0.17.1
.
And why should TensorVision/TensorVision#42 fix this? Are you planning to implement checks, testing whether gt is always loaded as greyscale?
Quite the opposite ;-)
I make sure that it is always loaded as RGB. But with the classes
attribute in hypes the TensorVision code makes sure the numpy array elements are class indices, not colors. So the user does not have to deal with this stuff.
When I try to train I still get an error (
python test_fcn32_vgg.py
works fine, though):