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

How to disable change the output tensor name? #28

Open
zhen8838 opened this issue Jun 30, 2019 · 2 comments
Open

How to disable change the output tensor name? #28

zhen8838 opened this issue Jun 30, 2019 · 2 comments
Assignees
Labels
feature request feature request technique:pruning Regarding tfmot.sparsity.keras APIs and docs

Comments

@zhen8838
Copy link

My model has multiple outputs when using model-optimization, the outputs node name has been changed like this:

982/982 [==============================] - 434s 442ms/step - loss: 17.4818 - prune_low_magnitude_l1_loss: 3.6453 - prune_low_magnitude_l2_loss: 10.2949 - prune_low_magnitude_l1_p: 0.8551 - prune_low_magnitude_l1_r: 0.6556 - prune_low_magnitude_l2_p: 0.7639 - prune_low_magnitude_l2_r: 0.4423 - val_loss: 16.9125 - val_prune_low_magnitude_l1_loss: 3.4677 - val_prune_low_magnitude_l2_loss: 9.9504 - val_prune_low_magnitude_l1_p: 0.8921 - val_prune_low_magnitude_l1_r: 0.7815 - val_prune_low_magnitude_l2_p: 0.8306 - val_prune_low_magnitude_l2_r: 0.5363

how to remove the prefix 'prune_low_magnitude' ?

@alanchiao alanchiao self-assigned this Jul 11, 2019
@alanchiao
Copy link

Is l1_loss the name of one of your Keras layers? We intentionally prefixed different layer names to indicate they were pruned ("prune" would seem preferable to something as long as "prune_low_magnitude" though). I can try shortening the prefix to "prune".

If it's not a layer, it is a bit unexpected (we add the prefix here: https://github.com/tensorflow/model-optimization/blob/master/tensorflow_model_optimization/python/core/sparsity/keras/pruning_wrapper.py#L141). Could you share sample code for this l1_loss to reproduce?

@zhen8838
Copy link
Author

The l1 is layer name, when I have multiple output layer, the loss name will change to l1_loss.

Can you just reduce the prefix length? Thanks

my code like :

y1_reshape = Reshape((7, 10, anchor_num, 5 + class_num), name='l1')(y1)
y2_reshape = Reshape((14, 20, anchor_num, 5 + class_num), name='l2')(y2)

yolo_model_warpper = keras.Model(inputs, [y1_reshape, y2_reshape])
.
.
.
yolo_model_warpper.compile(loss=[loss_fn(),loss_fn()])

@alanchiao alanchiao added the feature request feature request label Dec 26, 2019
@alanchiao alanchiao added the technique:pruning Regarding tfmot.sparsity.keras APIs and docs label Feb 20, 2020
@alanchiao alanchiao removed their assignment Dec 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request feature request technique:pruning Regarding tfmot.sparsity.keras APIs and docs
Projects
None yet
Development

No branches or pull requests

3 participants