{"id":23658,"library":"efficientnet","title":"EfficientNet","description":"Re-implementation of EfficientNet models for Keras and TensorFlow Keras, providing pretrained ImageNet weights for B0–B7 and Noisy Student weights for B0–B7. Current version 1.1.1, low maintenance.","status":"active","version":"1.1.1","language":"python","source_language":"en","source_url":"https://github.com/qubvel/efficientnet","tags":["efficientnet","keras","tensorflow","computer-vision","image-classification","deep-learning"],"install":[{"cmd":"pip install efficientnet","lang":"bash","label":"Install"}],"dependencies":[{"reason":"Core dependency for model implementation.","package":"keras","optional":false},{"reason":"Required for tf.keras backend.","package":"tensorflow","optional":true}],"imports":[{"note":"In older versions (<1.0.0) the module was different. Use top-level import.","wrong":"from efficientnet.model import EfficientNetB0","symbol":"EfficientNetB0","correct":"from efficientnet import EfficientNetB0"},{"note":"No common wrong import.","symbol":"preprocess_input","correct":"from efficientnet import preprocess_input"}],"quickstart":{"code":"from efficientnet import EfficientNetB0\nfrom tensorflow.keras.applications.imagenet_utils import decode_predictions\nimport numpy as np\n\n# Load model with pretrained weights\nmodel = EfficientNetB0(weights='imagenet')\n\n# Create a dummy image (224x224)\ndummy = np.random.rand(1, 224, 224, 3).astype(np.float32)\n\n# Predict\npreds = model.predict(dummy)\nprint(decode_predictions(preds, top=3)[0])\n","lang":"python","description":"Load an EfficientNetB0 model with ImageNet weights and run a prediction."},"warnings":[{"fix":"Use the new import pattern (from efficientnet import EfficientNetB0). Re-train or load weights carefully.","message":"API changed in v1.0.0: models must be imported from framework-specific modules. Previously trained models are not compatible; use model.load_weights or roll back.","severity":"breaking","affected_versions":">=0.0.4,<1.0.0"},{"fix":"Remove any custom swish registration; use keras.activations.swish directly.","message":"The 'swish' custom object is no longer required; the library now uses Keras' built-in Swish activation. If you have custom code relying on 'swish', update it.","severity":"deprecated","affected_versions":">=1.0.0b2"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'from efficientnet import EfficientNetB0' instead.","cause":"Old import path from pre-1.0.0 versions.","error":"ModuleNotFoundError: No module named 'efficientnet.model'"},{"fix":"Use custom_objects={'swish': keras.activations.swish} when loading the model.","cause":"Loading old saved models with custom swish activation not registered.","error":"ValueError: Unknown activation function: swish"},{"fix":"Specify input_shape as a tuple, e.g., EfficientNetB0(input_shape=(224,224,3)).","cause":"Misunderstanding of arguments: models expect input_shape or input_tensor, but modern API uses positional args differently.","error":"TypeError: __init__() missing 1 required positional argument: 'input_shape'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}