You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I have used this code to train a Document Layout Analysis model. I set: prediction_type = utils.PredictionType.MULTILABEL
And my classes.txt (9 classes) file:
Caused by op 'Label2Img/GatherNd', defined at:
File "train.py", line 47, in
@ex.automain
File "/home/it/.local/lib/python3.6/site-packages/sacred/experiment.py", line 137, in automain
self.run_commandline()
File "/home/it/.local/lib/python3.6/site-packages/sacred/experiment.py", line 260, in run_commandline
return self.run(cmd_name, config_updates, named_configs, {}, args)
File "/home/it/.local/lib/python3.6/site-packages/sacred/experiment.py", line 209, in run
run()
File "/home/it/.local/lib/python3.6/site-packages/sacred/run.py", line 221, in call
self.result = self.main_function(*args)
File "/home/it/.local/lib/python3.6/site-packages/sacred/config/captured_function.py", line 46, in captured_function
result = wrapped(*args, **kwargs)
File "train.py", line 111, in run
num_threads=32))
File "/home/it/.local/lib/python3.6/site-packages/tensorflow/python/estimator/estimator.py", line 356, in train
loss = self._train_model(input_fn, hooks, saving_listeners)
File "/home/it/.local/lib/python3.6/site-packages/tensorflow/python/estimator/estimator.py", line 1181, in _train_model
return self._train_model_default(input_fn, hooks, saving_listeners)
File "/home/it/.local/lib/python3.6/site-packages/tensorflow/python/estimator/estimator.py", line 1208, in _train_model_default
input_fn, model_fn_lib.ModeKeys.TRAIN))
File "/home/it/.local/lib/python3.6/site-packages/tensorflow/python/estimator/estimator.py", line 1049, in _get_features_and_labels_from_input_fn
self._call_input_fn(input_fn, mode))
File "/home/it/.local/lib/python3.6/site-packages/tensorflow/python/estimator/estimator.py", line 1136, in _call_input_fn
return input_fn(**kwargs)
File "/home/it/Projects/DLA/dhSegment/dh_segment/io/input.py", line 224, in fn
label_export = utils.multiclass_to_label_image(label_export, classes_file)
File "/home/it/Projects/DLA/dhSegment/dh_segment/utils/labels.py", line 67, in multiclass_to_label_image
return tf.gather_nd(c, tf.cast(class_label_tensor, tf.int32))
File "/home/it/.local/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py", line 3140, in gather_nd
"GatherNd", params=params, indices=indices, name=name)
File "/home/it/.local/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/it/.local/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 488, in new_func
return func(*args, **kwargs)
File "/home/it/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3272, in create_op
op_def=op_def)
File "/home/it/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1768, in init
self._traceback = tf_stack.extract_stack()
InvalidArgumentError (see above for traceback): Only indices.shape[-1] values between 1 and 7 are currently supported. Requested rank: 9
[[{{node Label2Img/GatherNd}} = GatherNd[Tindices=DT_INT32, Tparams=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"](Label2Img/GatherNd/params, Cast_1)]]
I guess that we can not train a multilabel classification model with more than 7 classes. Can anyone help me to fix this problems?
Thanks.
The text was updated successfully, but these errors were encountered:
It seems that this error is due to multiclass_to_label_image which is only used for visualization purposes (tf.summary), and not during training. I'll need to have a closer look to see if there is another/better way for visualizing many labels but for now you can comment the lines related to image summaries (the ones using multiclass_to_label_image).
Also regarding your classes.txt file, your classes seems to be mutually exclusive, i.e only one label is given to each color, so you should be using PredictionType.CLASSIFICATION (with only RGB codes in the classes.txt).
Hi,
I have used this code to train a Document Layout Analysis model. I set:
prediction_type = utils.PredictionType.MULTILABEL
And my
classes.txt
(9 classes) file:But I've got an error:
I guess that we can not train a multilabel classification model with more than 7 classes. Can anyone help me to fix this problems?
Thanks.
The text was updated successfully, but these errors were encountered: