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

It doesn't work when I set the in_channels=1 using from_name to define an efficientnet-b5. #322

Open
shijun18 opened this issue Mar 16, 2022 · 0 comments

Comments

@shijun18
Copy link

shijun18 commented Mar 16, 2022

Code:

net = EfficientNet.from_name(model_name='efficientnet-b5',in_channels=1)

Error:
TypeError: from_name() got an unexpected keyword argument 'in_channels'

By reading the source code, I found that from_name() contains the in_channels argument, as follows:

@classmethod
def from_name(cls, model_name, in_channels=3, **override_params):
    """Create an efficientnet model according to name.
    Args:
        model_name (str): Name for efficientnet.
        in_channels (int): Input data's channel number.
        override_params (other key word params):
            Params to override model's global_params.
            Optional key:
                'width_coefficient', 'depth_coefficient',
                'image_size', 'dropout_rate',
                'num_classes', 'batch_norm_momentum',
                'batch_norm_epsilon', 'drop_connect_rate',
                'depth_divisor', 'min_depth'
    Returns:
        An efficientnet model.
    """
    cls._check_model_name_is_valid(model_name)
    blocks_args, global_params = get_model_params(model_name, override_params)
    model = cls(blocks_args, global_params)
    model._change_in_channels(in_channels)
    return model

But it still raises the above error, I don't know the reason.
I look forward to any useful reply.

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