{"id":19659778,"url":"https://github.com/maicius/nima4images","last_synced_at":"2025-04-28T20:32:02.525Z","repository":{"id":82733602,"uuid":"157177698","full_name":"Maicius/NIMA4Images","owner":"Maicius","description":"修改model zoo 中的google nima 模型的pytorch实现，增加对批量图片的测试","archived":false,"fork":false,"pushed_at":"2018-11-12T08:51:49.000Z","size":11358,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T10:51:09.246Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Maicius.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-12T08:07:17.000Z","updated_at":"2024-05-03T12:06:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"c2020b38-117c-4eb4-9e89-f910e1a0c257","html_url":"https://github.com/Maicius/NIMA4Images","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maicius%2FNIMA4Images","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maicius%2FNIMA4Images/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maicius%2FNIMA4Images/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maicius%2FNIMA4Images/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Maicius","download_url":"https://codeload.github.com/Maicius/NIMA4Images/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251383839,"owners_count":21580949,"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":[],"created_at":"2024-11-11T15:44:21.604Z","updated_at":"2025-04-28T20:32:02.515Z","avatar_url":"https://github.com/Maicius.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyTorch NIMA: Neural IMage Assessment\n\nPyTorch implementation of [Neural IMage Assessment](https://arxiv.org/abs/1709.05424) by Hossein Talebi and Peyman Milanfar. You can learn more from [this post at Google Research Blog](https://research.googleblog.com/2017/12/introducing-nima-neural-image-assessment.html). \n\n\n## Installing\n\n```bash\ngit clone https://github.com/truskovskiyk/nima.pytorch.git \ncd nima.pytorch\nvirtualenv -p python3.6 env\nsource ./env/bin/activate\npip install -r requirements/linux_gpu.txt\n```\n\nor You can just use ready [Dockerfile](./Dockerfile)\n\n\n## Dataset\n\nThe model was trained on the [AVA (Aesthetic Visual Analysis) dataset](http://refbase.cvc.uab.es/files/MMP2012a.pdf)\nYou can get it from [here](https://github.com/mtobeiyf/ava_downloader)\nHere are some examples of images with theire scores \n![result1](https://3.bp.blogspot.com/-_BuiLfAsHGE/WjgoftooRiI/AAAAAAAACR0/mB3tOfinfgA5Z7moldaLIGn92ounSOb8ACLcBGAs/s1600/image2.png)\n\n## Model \n\nUsed MobileNetV2 architecture as described in the paper [Inverted Residuals and Linear Bottlenecks: Mobile Networks for Classification, Detection and Segmentation](https://arxiv.org/pdf/1801.04381).\n\n## Pre-train model  \n\nYou can use this [pretrain-model](https://s3-us-west-1.amazonaws.com/models-nima/pretrain-model.pth) with\n```bash\nval_emd_loss = 0.079\ntest_emd_loss = 0.080\n```\n## Deployment\n\nDeployed model on [heroku](https://www.heroku.com/) URL is https://neural-image-assessment.herokuapp.com/ You can use it for testing in Your own images, but pay attention, that's free service, so it cannot handel too many requests. Here is simple curl command to test deployment models\n```bash\ncurl  -X POST -F \"file=@123.jpg\" https://neural-image-assessment.herokuapp.com/api/get_scores\n```\nPlease use our [swagger](https://neural-image-assessment.herokuapp.com/apidocs) for interactive testing \n\n\n## Usage\n```bash\nexport PYTHONPATH=.\nexport PATH_TO_AVA_TXT=/storage/DATA/ava/AVA.txt\nexport PATH_TO_IMAGES=/storage/DATA/images/\nexport PATH_TO_CSV=/storage/DATA/ava/\nexport BATCH_SIZE=16\nexport NUM_WORKERS=2\nexport NUM_EPOCH=50\nexport INIT_LR=0.0001\nexport EXPERIMENT_DIR_NAME=/storage/experiment_n0001\n```\nClean and prepare dataset\n```bash\npython nima/cli.py prepare_dataset --path_to_ava_txt $PATH_TO_AVA_TXT \\\n                                    --path_to_save_csv $PATH_TO_CSV \\\n                                    --path_to_images $PATH_TO_IMAGES\n\n```\n\nTrain model\n```bash\npython nima/cli.py train_model --path_to_save_csv $PATH_TO_CSV \\\n                                --path_to_images $PATH_TO_IMAGES \\\n                                --batch_size $BATCH_SIZE \\\n                                --num_workers $NUM_WORKERS \\\n                                --num_epoch $NUM_EPOCH \\\n                                --init_lr $INIT_LR \\\n                                --experiment_dir_name $EXPERIMENT_DIR_NAME\n\n\n```\nUse tensorboard to tracking training progress\n\n```bash\ntensorboard --logdir .\n```\nValidate model on val and test datasets\n```bash\npython nima/cli.py validate_model --path_to_model_weight ./pretrain-model.pth \\\n                                    --path_to_save_csv $PATH_TO_CSV \\\n                                    --path_to_images $PATH_TO_IMAGES \\\n                                    --batch_size $BATCH_SIZE \\\n                                    --num_workers $NUM_EPOCH\n```\nGet scores for one image\n```bash\npython nima/cli.py get_image_score --path_to_model_weight ./pretrain-model.pth --path_to_image test_image.jpg\n```\n   \n## Contributing\n\nContributing are welcome\n\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details\n\n## Acknowledgments\n\n* [neural-image-assessment in keras](https://github.com/titu1994/neural-image-assessment)\n* [Neural-IMage-Assessment in pytorch](https://github.com/kentsyx/Neural-IMage-Assessment)\n* [pytorch-mobilenet-v2](https://github.com/tonylins/pytorch-mobilenet-v2)\n* [origin NIMA article](https://arxiv.org/abs/1709.05424)\n* [origin MobileNetV2 article](https://arxiv.org/pdf/1801.04381)\n* [Post at Google Research Blog](https://research.googleblog.com/2017/12/introducing-nima-neural-image-assessment.html)\n* [Heroku: Cloud Application Platform](https://www.heroku.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaicius%2Fnima4images","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaicius%2Fnima4images","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaicius%2Fnima4images/lists"}