Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arg_scope #3

Open
joey1993 opened this issue Jul 13, 2019 · 8 comments
Open

arg_scope #3

joey1993 opened this issue Jul 13, 2019 · 8 comments

Comments

@joey1993
Copy link

joey1993 commented Jul 13, 2019

I ran into an error when executing "sh train.sh" for a toy model. Before this step, I generated all the features. Any idea on debugging this?

Traceback (most recent call last):
  File "train/eval.py", line 265, in <module>
    app.run()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 125, in run
    _sys.exit(main(argv))
  File "train/eval.py", line 178, in main
    predictions = model.build_evaluation_graph(examples)
  File "/workspace/ADVISE/models/advise_model.py", line 313, in build_evaluation_graph
    examples['img_features'], examples['roi_features'])
  File "/workspace/ADVISE/models/advise_model.py", line 92, in encode_image
    roi_features_reshaped, model_proto.image_encoder, is_training)
  File "/workspace/ADVISE/models/utils.py", line 67, in encode_feature
    with slim.arg_scope(hp):
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/framework/python/ops/arg_scope.py", line 144, in arg_scope
    raise TypeError('list_ops_or_scope must either be a list/tuple or reused '
TypeError: list_ops_or_scope must either be a list/tuple or reused scope (i.e. dict)
@Pg-Man
Copy link

Pg-Man commented Jul 31, 2019

Did you fix it ?

@yekeren
Copy link
Owner

yekeren commented Aug 1, 2019

Please check the implementation of https://github.com/tensorflow/models/blob/c92a7e169f03c8672a21e6c2172bc8e5d174115b/research/object_detection/builders/hyperparams_builder.py#L178.

The hyperparameter_builder.build() function now returns a function. However, for the previous OBJECT_DETECTION version, the build function returns a list/tuple (I cannot remember clearly).

Please refer https://github.com/tensorflow/models/blob/c92a7e169f03c8672a21e6c2172bc8e5d174115b/research/object_detection/predictors/convolutional_box_predictor.py#L145 to use. That is, call the returned function.

@yekeren
Copy link
Owner

yekeren commented Aug 1, 2019

I ran into an error when executing "sh train.sh" for a toy model. Before this step, I generated all the features. Any idea on debugging this?

Traceback (most recent call last):
  File "train/eval.py", line 265, in <module>
    app.run()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 125, in run
    _sys.exit(main(argv))
  File "train/eval.py", line 178, in main
    predictions = model.build_evaluation_graph(examples)
  File "/workspace/ADVISE/models/advise_model.py", line 313, in build_evaluation_graph
    examples['img_features'], examples['roi_features'])
  File "/workspace/ADVISE/models/advise_model.py", line 92, in encode_image
    roi_features_reshaped, model_proto.image_encoder, is_training)
  File "/workspace/ADVISE/models/utils.py", line 67, in encode_feature
    with slim.arg_scope(hp):
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/framework/python/ops/arg_scope.py", line 144, in arg_scope
    raise TypeError('list_ops_or_scope must either be a list/tuple or reused '
TypeError: list_ops_or_scope must either be a list/tuple or reused scope (i.e. dict)

Please let me know if the solution works.

@yekeren
Copy link
Owner

yekeren commented Aug 1, 2019

Did you fix it ?

Please see my suggestions.

@Pg-Man
Copy link

Pg-Man commented Aug 3, 2019

When my code changed to this,

`if not isinstance(config, utils_pb2.FCEncoder):
raise ValueError('The config has to be an instance of FCEncoder.')

hp = hyperparams_builder.build(config.fc_hyperparams, is_training=is_training)

node = features
node = slim.dropout(node, config.input_dropout_keep_prob,
is_training=is_training)
with slim.arg_scope(hp()):
node = slim.fully_connected(node, config.num_outputs,
scope=config.scope, reuse=reuse)
node = slim.dropout(node, config.output_dropout_keep_prob,
is_training=is_training)`

it didn't report the previous error, but a new error occurred.

File "train/eval.py", line 266, in <module> app.run() File "/home/ypj/.local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 125, in run _sys.exit(main(argv)) File "train/eval.py", line 179, in main predictions = model.build_evaluation_graph(examples) File "/home/ypj/文档/ADVISE/ADVISE/models/vse_model.py", line 120, in build_evaluation_graph statement_strings_reshaped, statement_lengths_reshaped) File "/home/ypj/文档/ADVISE/ADVISE/text_encoders/bow_encoder.py", line 110, in encode self._set_init_fn(embedding_weights, model_proto.init_emb_matrix_path) File "/home/ypj/文档/ADVISE/ADVISE/text_encoders/bow_encoder.py", line 46, in _set_init_fn embedding_weights.op.name: word2vec} ) File "/home/ypj/.local/lib/python2.7/site-packages/tensorflow/contrib/framework/python/ops/variables.py", line 508, in assign_from_values feed_dict[placeholder_value] = var_value.reshape(var.get_shape()) ValueError: cannot reshape array of size 5066200 into shape (25333,200)

@yekeren
Copy link
Owner

yekeren commented Aug 4, 2019 via email

@Pg-Man
Copy link

Pg-Man commented Aug 4, 2019

Your vocabulary size is wrong.
On Sat, Aug 3, 2019 at 6:46 AM Pg-Man @.***> wrote: When my code changed to this, if not isinstance(config, utils_pb2.FCEncoder): raise ValueError('The config has to be an instance of FCEncoder.') hp = hyperparams_builder.build(config.fc_hyperparams, is_training=is_training) node = features node = slim.dropout(node, config.input_dropout_keep_prob, is_training=is_training) with slim.arg_scope(hp()): node = slim.fully_connected(node, config.num_outputs, scope=config.scope, reuse=reuse) node = slim.dropout(node, config.output_dropout_keep_prob, is_training=is_training) it didn't report the previous error, but a new error occurred. File "train/eval.py", line 266, in app.run() File "/home/ypj/.local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 125, in run _sys.exit(main(argv)) File "train/eval.py", line 179, in main predictions = model.build_evaluation_graph(examples) File "/home/ypj/文档/ADVISE/ADVISE/models/vse_model.py", line 120, in build_evaluation_graph statement_strings_reshaped, statement_lengths_reshaped) File "/home/ypj/文档/ADVISE/ADVISE/text_encoders/bow_encoder.py", line 110, in encode self._set_init_fn(embedding_weights, model_proto.init_emb_matrix_path) File "/home/ypj/文档/ADVISE/ADVISE/text_encoders/bow_encoder.py", line 46, in _set_init_fn embedding_weights.op.name: word2vec} ) File "/home/ypj/.local/lib/python2.7/site-packages/tensorflow/contrib/framework/python/ops/variables.py", line 508, in assign_from_values feed_dict[placeholder_value] = var_value.reshape(var.get_shape()) ValueError: cannot reshape array of size 5066200 into shape (25333,200) — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#3?email_source=notifications&email_token=AA6CPAIVYIK7GOLWN6BKQ33QCUER7A5CNFSM4ICTNBH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3PG7KY#issuecomment-517894059>, or mute the thread https://github.com/notifications/unsubscribe-auth/AA6CPAPHJ5SFGJNT3FWG3G3QCUER7ANCNFSM4ICTNBHQ .
-- Thanks, best regards. Keren

Dear Sir,
I am very happy to hear from you that I am vocabulary size set incorrectly.

In fact, In fact, I also found the problem of vocabulary size because 25333*200 =5066600>5066200. Since I am learning the way to image recognition, it is difficult to find out which file to change the relevant code in. After I cloned your code from github, I didn't change them, so I don't know why there was this error. Sincerely like you for help, please tell me which file to modify and how to modify it. Forgive me for your harassment.

Thanks,best regards.

PG-Man

@yekeren
Copy link
Owner

yekeren commented Aug 4, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants