{"id":29091355,"url":"https://github.com/iamsdt/multilabelmovieposterclassification","last_synced_at":"2025-06-28T06:07:07.485Z","repository":{"id":39854036,"uuid":"235590629","full_name":"Iamsdt/MultilabelMoviePosterClassification","owner":"Iamsdt","description":"Multilabel image classification to classify movie poster and find appropriate movie genre with movie poster. For this project tensorflow framwork is used for deep learning model. The model is converted into tf lite to reduce final model size. This is a complete project with server side code and also fronted. To deploy deep learning model, flask is used and deployed into heroku server. By using Flutter framework frontend web app is developed and deployed into firebase.","archived":false,"fork":false,"pushed_at":"2022-11-21T22:42:58.000Z","size":51611,"stargazers_count":3,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-03-09T03:26:34.218Z","etag":null,"topics":["flask","flutter","flutter-web","image-classification","multilabel-classification","tensorflow","tflite"],"latest_commit_sha":null,"homepage":"https://flutter-web-3a021.firebaseapp.com/","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Iamsdt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-22T14:27:03.000Z","updated_at":"2022-12-09T20:38:49.000Z","dependencies_parsed_at":"2023-01-22T10:00:57.503Z","dependency_job_id":null,"html_url":"https://github.com/Iamsdt/MultilabelMoviePosterClassification","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"purl":"pkg:github/Iamsdt/MultilabelMoviePosterClassification","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Iamsdt%2FMultilabelMoviePosterClassification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Iamsdt%2FMultilabelMoviePosterClassification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Iamsdt%2FMultilabelMoviePosterClassification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Iamsdt%2FMultilabelMoviePosterClassification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Iamsdt","download_url":"https://codeload.github.com/Iamsdt/MultilabelMoviePosterClassification/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Iamsdt%2FMultilabelMoviePosterClassification/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262382744,"owners_count":23302298,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flask","flutter","flutter-web","image-classification","multilabel-classification","tensorflow","tflite"],"created_at":"2025-06-28T06:06:50.855Z","updated_at":"2025-06-28T06:07:07.471Z","avatar_url":"https://github.com/Iamsdt.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Multilabel Movie Poster Classification\n\nMultilabel image classification to classify movie poster and find appropriate movie genre with movie poster. For this project **tensorflow** framwork is used for deep learning model. The model is converted into **tf lite** to reduce final model size. This is a complete project with server side code and also fronted. To deploy deep learning model, **flask** is used and deployed into **heroku** server. By using **Flutter** framework frontend web app is developed and deployed into **firebase**.\n\n**Notebook**: [Click here](https://github.com/Iamsdt/MultilabelMoviePosterClassification/blob/master/notebook/Multilabel_Image.ipynb)\n\n**Web App**: [Movie Poster Classifier](https://flutter-web-3a021.firebaseapp.com/#/)\n\n\n\n## AI model\n\nFramework: Tensorflow 2.1\n\nDatasets: [Movie_Poster_Dataset](https://www.cs.ccu.edu.tw/~wtchu/projects/MoviePoster/Movie_Poster_Dataset.zip)\n\n### Classifier Architecture\n\n**Input Shape**: (350, 350, 3)\n\n**Label**: (24)\n\n**Output Shape**: (24)\n\n**Model Summary**\n\n```\nModel: \"sequential\"\n_________________________________________________________________\nLayer (type)                 Output Shape              Param #   \n=================================================================\nconv2d (Conv2D)              (None, 348, 348, 16)      448       \n_________________________________________________________________\nbatch_normalization (BatchNo (None, 348, 348, 16)      64        \n_________________________________________________________________\ndropout (Dropout)            (None, 348, 348, 16)      0         \n_________________________________________________________________\nconv2d_1 (Conv2D)            (None, 346, 346, 32)      4640      \n_________________________________________________________________\nbatch_normalization_1 (Batch (None, 346, 346, 32)      128       \n_________________________________________________________________\nmax_pooling2d (MaxPooling2D) (None, 173, 173, 32)      0         \n_________________________________________________________________\ndropout_1 (Dropout)          (None, 173, 173, 32)      0         \n_________________________________________________________________\nconv2d_2 (Conv2D)            (None, 171, 171, 64)      18496     \n_________________________________________________________________\nbatch_normalization_2 (Batch (None, 171, 171, 64)      256       \n_________________________________________________________________\nmax_pooling2d_1 (MaxPooling2 (None, 85, 85, 64)        0         \n_________________________________________________________________\ndropout_2 (Dropout)          (None, 85, 85, 64)        0         \n_________________________________________________________________\nconv2d_3 (Conv2D)            (None, 83, 83, 128)       73856     \n_________________________________________________________________\nbatch_normalization_3 (Batch (None, 83, 83, 128)       512       \n_________________________________________________________________\nmax_pooling2d_2 (MaxPooling2 (None, 41, 41, 128)       0         \n_________________________________________________________________\ndropout_3 (Dropout)          (None, 41, 41, 128)       0         \n_________________________________________________________________\nflatten (Flatten)            (None, 215168)            0         \n_________________________________________________________________\ndense (Dense)                (None, 128)               27541632  \n_________________________________________________________________\nbatch_normalization_4 (Batch (None, 128)               512       \n_________________________________________________________________\ndropout_4 (Dropout)          (None, 128)               0         \n_________________________________________________________________\ndense_1 (Dense)              (None, 128)               16512     \n_________________________________________________________________\nbatch_normalization_5 (Batch (None, 128)               512       \n_________________________________________________________________\ndropout_5 (Dropout)          (None, 128)               0         \n_________________________________________________________________\ndense_2 (Dense)              (None, 24)                3096      \n=================================================================\nTotal params: 27,660,664\nTrainable params: 27,659,672\nNon-trainable params: 992\n```\n\n\n\n### Hyperparameters\n\n| Parameters    |                     |\n| ------------- | ------------------- |\n| Optimizer     | Adam                |\n| Learning rate | 0.001               |\n| Loss function | Binary Crossentropy |\n| Batch size    | 32                  |\n| Epoch         | 5                   |\n\n### Training Logs\n\n```\nTrain on 6854 samples, validate on 1210 samples\nEpoch 1/5\n6854/6854 [==============================] - 39s 6ms/sample - loss: 0.6711 - accuracy: 0.6647 - val_loss: 0.3302 - val_accuracy: 0.9021\nEpoch 2/5\n6854/6854 [==============================] - 34s 5ms/sample - loss: 0.3010 - accuracy: 0.8932 - val_loss: 0.2634 - val_accuracy: 0.9020\nEpoch 3/5\n6854/6854 [==============================] - 34s 5ms/sample - loss: 0.2676 - accuracy: 0.9039 - val_loss: 0.2620 - val_accuracy: 0.9027\nEpoch 4/5\n6854/6854 [==============================] - 34s 5ms/sample - loss: 0.2602 - accuracy: 0.9062 - val_loss: 0.2636 - val_accuracy: 0.9030\nEpoch 5/5\n6854/6854 [==============================] - 34s 5ms/sample - loss: 0.2555 - accuracy: 0.9072 - val_loss: 0.2640 - val_accuracy: 0.9030\n```\n\n### Loss \u0026 Accuracy Graph\n\u003cimg src='img/loss.png'/\u003e\n\u003cimg src='img/acc.png'/\u003e\n\n### Output\n\u003cimg src='img/output.png'/\u003e\n\n\n### Model Conversion\n\nTensor flow model is converted into tf.lite. The main model size is 350 mb+, after convert into tf lite the final size ~ 55 mb+.\n\n```python\nconverter = tf.lite.TFLiteConverter.from_keras_model(net)\ntflite_model = converter.convert()\n```\n\nThis conversion reduce model size into ~110 mb.\n\nNext, Float32 converted into Float 16.\n\n```\nconverter.optimizations = [tf.lite.Optimize.DEFAULT]\nconverter.target_spec.supported_types = [tf.float16]\ntflite_fp16_model = converter.convert()\n```\n\nAnd saved optimized model\n\n```\ntflite_model_fp16_file = tflite_models_dir/\"movie_optimized.tflite\"\ntflite_model_fp16_file.write_bytes(tflite_fp16_model)\n```\n\nNow model size is 55.00 mb\n\nCompare outputs between 3 models (tensorflow model, tflite model, tflite optimized model)\n\n```\nOutput from tensorflow model:, War, Action, News\nOutput from tensorflow lite model:, War, Action, News\nOutput from tensorflow lite optimized model:, War, Action, News\n```\n\n### Notebook link: [Click here](https://github.com/Iamsdt/MultilabelMoviePosterClassification/blob/master/notebook/Multilabel_Image.ipynb)\n\n\n\n## Web Server\n\n![](https://miro.medium.com/max/2560/1*D0rJozJto_S4eO2ab-qWtQ.jpeg)\n\nFor deploying model **Flask** is used\n\nUsed libraries\n\n```\ntensorflow\nnumpy\nFlask==1.1.1\ngunicorn==20.0.4\nPillow\nflask-cors\n```\n\nServer accept **post** request with image bytes as data and return the predicted values in **json** format.\n\n```\n@app.route('/analysis/', methods=['POST', 'GET'])\ndef analysis():\n    if request.method == 'POST':\n        img = request.data\n        response = predict(img)\n        data = {\n            \"result\": response\n        }\n        return jsonify(\n            data)\n```\n\n#### Server link: https://rocky-beyond-88001.herokuapp.com/analysis\n\n\n\n## Webapp\n\n![](https://flutter.dev/assets/flutter-lockup-c13da9c9303e26b8d5fc208d2a1fa20c1ef47eb021ecadf27046dea04c0cebf6.png)\n\nFor frontend web app, **Flutter web framework** is used\n\n### Flutter Version: \n\n**Flutter 1.15.19**\n\n**Dart 2.8.0**\n\n### Used Libraries\n\n```\nhttp: ^0.12.0+4\nhtml: ^0.14.0+3\nretrofit: ^1.3.1+1\nlogger: ^0.8.3\nstates_rebuilder: ^1.14.2\njson_annotation: ^3.0.1\nurl_launcher: ^5.4.2\n```\n\nWebsite deployed in **Firebase**\n\n#### Web app link: [Movie Poster Classifier](https://flutter-web-3a021.firebaseapp.com/#/)\n\u003cbr/\u003e\n\n### Web App Screenshot\n\u003cimg src='img/web.png' /\u003e\n\n\n## Want to run locally?\n\nClone this repo\n\n```\ngit clone https://github.com/Iamsdt/MultilabelMoviePosterClassification.git\n```\n\nFor **AI model** see this notebook, [click here](https://github.com/Iamsdt/MultilabelMoviePosterClassification/blob/master/notebook/Multilabel_Image.ipynb)\n\n**Server side code**: all the server side code including model file located into **server** folder\n\n**Flutter Web App**: Located into **app/web_app**\n\nOpen in the IDE with flutter plugin and run this command, to generate\n\n```\nflutter run -d chrome\n```\n\nNote: you need chorme web browser to run locally.\n\n\u003cbr/\u003e\n\n## License\n\nThis project is under [Apache License 2.0](https://github.com/Iamsdt/MultilabelMoviePosterClassification/blob/master/LICENSE).\n\n```\nCopyright {2020} {Shudipto Trafder}\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamsdt%2Fmultilabelmovieposterclassification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiamsdt%2Fmultilabelmovieposterclassification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamsdt%2Fmultilabelmovieposterclassification/lists"}