There are some problems in the classification of Tensorflow pre-training networks using inception_resnet_v2.

1 problem description

the actual combat is to use the code in the slim framework to use inception_resnet_v2 "s pre-training network to train their own data sets for classification. But there is

.
InvalidArgumentError (see above for traceback): Assign requires shapes of both tensors to match. lhs shape= [764] rhs shape= [1001]
     [[Node: save/Assign_8 = Assign[T=DT_FLOAT, _class=["loc:@InceptionResnetV2/AuxLogits/Logits/biases"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](InceptionResnetV2/AuxLogits/Logits/biases, save/RestoreV2_8)]]

this kind of problem probably means that I put 1001element into element only 764, resulting in an error

.

2

through the search, I found that someone also encountered similar problems, so you can delete the previously trained checkpoint data. But I am in tinymind computing (the equivalent of cloud computing), there should be no data left by previous training.
tried to change the slim framework code without success (maybe not right).

related codes

/ / Please paste the code text below (do not replace the code with pictures)

Caused by op "save/Assign_8", defined at:
  File "./train_image_classifier.py", line 581, in 
    tf.app.run()
  File "/opt/conda/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 124, in run
    _sys.exit(main(argv))
  File "./train_image_classifier.py", line 571, in main
    init_fn=_get_init_fn(),
  File "./train_image_classifier.py", line 369, in _get_init_fn
    ignore_missing_vars=FLAGS.ignore_missing_vars)
  File "/opt/conda/lib/python3.6/site-packages/tensorflow/contrib/framework/python/ops/variables.py", line 688, in assign_from_checkpoint_fn
    saver = tf_saver.Saver(var_list, reshape=reshape_variables)
  File "/opt/conda/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1239, in __init__
    self.build()
  File "/opt/conda/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1248, in build
    self._build(self._filename, build_save=True, build_restore=True)
  File "/opt/conda/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1284, in _build
    build_save=build_save, build_restore=build_restore)
  File "/opt/conda/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 765, in _build_internal
    restore_sequentially, reshape)
  File "/opt/conda/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 440, in _AddRestoreOps
    assign_ops.append(saveable.restore(tensors, shapes))
  File "/opt/conda/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 160, in restore
    self.op.get_shape().is_fully_defined())
  File "/opt/conda/lib/python3.6/site-packages/tensorflow/python/ops/state_ops.py", line 276, in assign
    validate_shape=validate_shape)
  File "/opt/conda/lib/python3.6/site-packages/tensorflow/python/ops/gen_state_ops.py", line 59, in assign
    use_locking=use_locking, name=name)
  File "/opt/conda/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
    op_def=op_def)
  File "/opt/conda/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3160, in create_op
    op_def=op_def)
  File "/opt/conda/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1625, in __init__
    self._traceback = self._graph._extract_stack()  -sharp pylint: disable=protected-access

3

has any god ever encountered this kind of situation (not caused by the old checkpoint data)? thank you here.
slim framework
https://github.com/tensorflow.

Apr.09,2021

is still not done. I feel like I have to give up this model


I delete the checkpoint in train_dir and then I can train. I use inceptionv3

Menu