{"id":13823119,"url":"https://github.com/icoxfog417/mlimages","last_synced_at":"2025-04-06T09:31:52.129Z","repository":{"id":4192524,"uuid":"52141847","full_name":"icoxfog417/mlimages","owner":"icoxfog417","description":"prepare the image data set for machine learning","archived":false,"fork":false,"pushed_at":"2022-12-26T20:25:39.000Z","size":1168,"stargazers_count":24,"open_issues_count":11,"forks_count":12,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-21T21:22:08.509Z","etag":null,"topics":["computer-vision","machine-learning"],"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/icoxfog417.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":"2016-02-20T07:18:24.000Z","updated_at":"2023-06-09T14:26:12.000Z","dependencies_parsed_at":"2023-01-13T12:59:49.740Z","dependency_job_id":null,"html_url":"https://github.com/icoxfog417/mlimages","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icoxfog417%2Fmlimages","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icoxfog417%2Fmlimages/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icoxfog417%2Fmlimages/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icoxfog417%2Fmlimages/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/icoxfog417","download_url":"https://codeload.github.com/icoxfog417/mlimages/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247463745,"owners_count":20942935,"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":["computer-vision","machine-learning"],"created_at":"2024-08-04T09:00:21.948Z","updated_at":"2025-04-06T09:31:51.129Z","avatar_url":"https://github.com/icoxfog417.png","language":"Python","funding_links":[],"categories":["Neural Networks, Data processing, Useful Tools"],"sub_categories":[],"readme":"# mlimages\n\ngather and create image dataset for machine learning.\n\n![imagenet](./doc/mlimages.PNG)\n\n\n## How to use\n\n```\npip install mlimages\n```\n\nOr clone the repository. Then you can execute examples.\nIf you want to do fine tuning, you can download pretrained model in `examples/pretrained` by [git lfs](https://git-lfs.github.com/).\n\nThis tool dependes on Python 3.5 that has async/await feature!\n\n\n## Gather Images\n\nPlease make python file in your project folder as below.\n\n```py\nimport mlimages.scripts.gather_command as cmd\n\nif __name__ == \"__main__\":\n    ps = cmd.make_parser()\n    args = ps.parse_args()\n    cmd.main(args)\n```\n\n### Imagenet\n\nConfirm the **WordnetID** on the [ImageNet site](http://image-net.org/synset)\n\n![imagenet](./doc/imagenet.PNG)\n\nThen download it.\n\n```\npython your_script_file.py -p path/to/data/folder -imagenet --wnid n11531193\n```\n\n## Labeling\n\nYou can create training data from images data folder.\n\nPlease make python file in your project folder as below.\n\n```py\nimport mlimages.scripts.label_command as cmd\n\nif __name__ == \"__main__\":\n    ps = cmd.make_parser()\n    args = ps.parse_args()\n    cmd.main(args)\n```\n\nThen run it.\n\n```\npython label.py path/to/images/folder --out path/to/training_data.txt\n```\n\n## Training\n\nNow, you have images and training_data.txt.\nBut you have to do some pre-processing to train your model. For example...\n\n* resize image\n* normalize image\n* sometimes change color...\n\n:sob:\n\nDon't warry. mlimages supports you!\n\n\n```py\nfrom mlimages.model import LabelFile, ImageProperty\n\n\nlf = LabelFile(\"path/to/training_data.txt\", img_root=\"path_to_your_image_folder\")\nprop = ImageProperty(width=32, gray_scale=True)\n\ntd = lf.to_training_data(prop)\ntd.make_mean_image(\"path/to/mean_image\")  # store mean image to normalize\n\nfor d in td.generate():\n    # d is numpy array that adjusted according to ImageProperty, and normalized by mean_image!\n    # only you have to do is train the model by it!\n    print(d)\n\n```\n\nAnd also, you can restore the image from data.\n\n```py\nimage = td.result_to_image(numpy_array, label)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficoxfog417%2Fmlimages","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficoxfog417%2Fmlimages","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficoxfog417%2Fmlimages/lists"}