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

can tf-expain explain tf-lite models? #174

Open
showkeyjar opened this issue Sep 26, 2021 · 1 comment
Open

can tf-expain explain tf-lite models? #174

showkeyjar opened this issue Sep 26, 2021 · 1 comment

Comments

@showkeyjar
Copy link

can tf-expain explain tf-lite models?

if can, how to explain?

if not, would you have some advice or suggestion?

@showkeyjar
Copy link
Author

I fig it out,
would you please check this idea is right?

I rewrite a OcclusionSensitivity class and use python read tf.lite model then predict

the key codes:

`
def get_sensitivity_map(self, interpreter, image, class_index, patch_size):
# interpreter is tf.lite model
...
interpreter.allocate_tensors()
for patch in tqdm(patches):
interpreter.set_tensor(interpreter.get_input_details()[0]['index'], [patch])
interpreter.invoke()
preds = interpreter.get_tensor(interpreter.get_output_details()[0]['index'])
predictions.extend(preds)

    target_class_predictions = [
        prediction[class_index] for prediction in predictions
    ]
    ...

`

beacause I can't find how to batch predict image use tf.lite model, so I make a for loop and set a bigger patch_size

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

1 participant