{"record":{"id":"cb9ef6525ba05529","repo":"keras-team/keras","slug":"if-using-weights-imagenet-with-include-top-tr-cb9ef6","errorCode":null,"errorMessage":"If using `weights=\"imagenet\"` with `include_top=True`, `classes` should be 1000. Received classes={classes}","messagePattern":"If using `weights=\"imagenet\"` with `include_top=True`, `classes` should be 1000\\. Received classes=(.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/applications/inception_resnet_v2.py","lineNumber":106,"sourceCode":"            Ignored unless `include_top=True`.\n            Set `classifier_activation=None` to return the logits\n            of the \"top\" layer. When loading pretrained weights,\n            `classifier_activation` can only be `None` or `\"softmax\"`.\n        name: The name of the model (string).\n\n    Returns:\n        A model instance.\n    \"\"\"\n    if not (weights in {\"imagenet\", None} or file_utils.exists(weights)):\n        raise ValueError(\n            \"The `weights` argument should be either \"\n            \"`None` (random initialization), `imagenet` \"\n            \"(pre-training on ImageNet), \"\n            \"or the path to the weights file to be loaded.\"\n        )\n\n    if weights == \"imagenet\" and include_top and classes != 1000:\n        raise ValueError(\n            'If using `weights=\"imagenet\"` with `include_top=True`, '\n            \"`classes` should be 1000. \"\n            f\"Received classes={classes}\"\n        )\n\n    # Determine proper input shape\n    input_shape = imagenet_utils.obtain_input_shape(\n        input_shape,\n        default_size=299,\n        min_size=75,\n        data_format=backend.image_data_format(),\n        require_flatten=include_top,\n        weights=weights,\n    )\n\n    if input_tensor is None:\n        img_input = layers.Input(shape=input_shape)\n    else:","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/applications/inception_resnet_v2.py#L88-L124","documentation":"Error \"If using `weights=\"imagenet\"` with `include_top=True`, `classes` should be 1000. Received classes={classes}\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/applications/inception_resnet_v2.py:106 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","schemaVersion":2},"datasetVersion":"2026-08-26T02:17:13.382Z"}