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

Hi, #14

Open
LucyGarlapati opened this issue Jan 6, 2020 · 5 comments
Open

Hi, #14

LucyGarlapati opened this issue Jan 6, 2020 · 5 comments

Comments

@LucyGarlapati
Copy link

No description provided.

@LucyGarlapati
Copy link
Author

I tried Image classification using MobilenetV3 both small & large. How to do inference on test image. I am getting error saying
"ValueError: Unknown activation function:_hard_swish"

@rokopi-byte
Copy link

you have to redefine the custom objects like hard_wish in your inference script and pass them to the load_model function

@YuliyaLi
Copy link

YuliyaLi commented Nov 8, 2020

hi, did you solve this problem? i am still getting an error "TypeError: _hard_swish() missing 1 required positional argument: 'x'" when i pass the custom objects to the load_model function. Thanks.

@rokopi-byte
Copy link

Yes, this is what I did..

def relu6(x):
    """Relu 6
    """
    return K.relu(x, max_value=6.0)

def hard_swish(x):
    """Hard swish
    """
    return x * K.relu(x + 3.0, max_value=6.0) / 6.0

dependencies = {'_hard_swish': hard_swish,'_relu6': relu6}
model = load_model(model_path, custom_objects=dependencies)

@YuliyaLi
Copy link

YuliyaLi commented Nov 8, 2020

Thanks a million!!!

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