{"id":22635968,"url":"https://github.com/webduinoio/maix_train","last_synced_at":"2025-03-29T04:45:55.086Z","repository":{"id":93926275,"uuid":"411999763","full_name":"webduinoio/maix_train","owner":"webduinoio","description":null,"archived":false,"fork":false,"pushed_at":"2021-10-01T03:50:58.000Z","size":13865,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-03T14:41:18.152Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/webduinoio.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":"2021-09-30T09:19:11.000Z","updated_at":"2021-10-01T03:51:01.000Z","dependencies_parsed_at":"2023-04-16T21:02:17.021Z","dependency_job_id":null,"html_url":"https://github.com/webduinoio/maix_train","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/webduinoio%2Fmaix_train","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webduinoio%2Fmaix_train/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webduinoio%2Fmaix_train/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webduinoio%2Fmaix_train/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webduinoio","download_url":"https://codeload.github.com/webduinoio/maix_train/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246140544,"owners_count":20729797,"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-12-09T03:17:30.929Z","updated_at":"2025-03-29T04:45:55.080Z","avatar_url":"https://github.com/webduinoio.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"train_scripts\n===========\n\nYou can also train on [Maixhub.com](https://www.maixhub.com), \njust upload your datasets and you will get the result(kmodel and usage code)\n\n## Train type\n\n* Object classification(Mobilenet V1): judge class of image\n* Object detection(YOLO v2): find a recognizable object in the picture\n\n\n## Usage\n\n### 0. Prepare\n\n* only support `Linux`\n* Prepare environment, use CPU or GPU to train\nAt your fist time train, CPU is recommended, just\n```\npip3 install -r requirements.txt\n```\nor use aliyun's source if you are in China\n```\npip3 install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/\n```\n\n* [Download nncase](https://github.com/kendryte/nncase/releases/tag/v0.1.0-rc5) and unzip it to `tools/ncc/ncc_v0.1`, and the executable path is `tools/ncc/ncc_v0.1/ncc`\n* `python3 train.py init`\n* Edit `instance/config.py` according to your hardware\n* Prepare dataset, in the `datasets` directory has some example datasets, input size if `224x224`\n  or you just fllow [maixhub](https://www.maixhub.com/mtrain.html)'s conduct\n\n### 1. Object classification (Mobilenet V1)\n\n```\npython3 train.py -t classifier -z datasets/test_classifier_datasets.zip train\n```\nor assign datasets directory\n```\npython3 train.py -t classifier -d datasets/test_classifier_datasets train\n```\n\nmore command see`python3 train.py -h`\n\n\nand you will see output in the `out` directory, packed as a zip file\n\n\n### 2. Object detection (YOLO V2)\n\n\n```\npython3 train.py -t detector -z datasets/test_detector_xml_format.zip train\n```\n\nmore command see`python3 train.py -h`\n\nand you will see output in the `out` directory, packed as a zip file\n\n\n## Use GPU\n\nUse docker or install tensorflow with GPU in your local environment\n\nTensorflow's version should \u003e= 2.0, tested on 2.1\n\n### Use docker(recommend)\n\nsee [tensorflow official website](https://tensorflow.google.cn/install/docker) (或者可以参考[这篇教程](https://neucrack.com/p/116))\n\n* Install docker\n* Install [nvidia-docker](https://github.com/NVIDIA/nvidia-docker)\n* Pull docker image\n```\ndocker pull neucrack/tensorflow-gpu-py3-jupyterlab\n```\nor\n```\ndocker pull daocloud.io/neucrack/tensorflow-gpu-py3-jupyterlab\n```\n* Test environment\n```\ndocker run --gpus all -it --rm neucrack/tensorflow-gpu-py3-jupyterlab python -c \"import tensorflow as tf; print('-----version:{}, gpu:{}, 1+2={}'.format(tf.__version__, tf.test.is_gpu_available(), tf.add(1, 2).numpy()) );\"\n```\nif output is`-----version:2.1.0, gpu:True, 1+2=3`, that's ok(maybe version can `\u003e 2.1.0`)\n* Create docker container\n```shell\ndocker run --gpus all --name jupyterlab-gpu -it -p 8889:8889 -e USER_NAME=$USER -e USER_ID=`id -u $USER` -e GROUP_NAME=`id -gn $USER` -e GROUP_ID=`id -g $USER` -v /home/${USER}:/tf neucrack/tensorflow-gpu-py3-jupyterlab\n```\nIf used daocloud, image name should be change to `daocloud.io/neucrack/tensorflow-gpu-py3-jupyterlab`\n\nThis will mount your`/home/$USER` directory to `/tf` directory of container, the `/tf` is the root dir of jupyterlab\n\nStop by `docker stop jupyterlab-gpu`, start again by `docker start jupyterlab-gpu`\nTo use `sudo` command, edit user password by\n```shell\ndocker exec -it jupyterlab_gpu /bin/bash\npasswd $USER\npasswd root\n```\n\n* use jupyterlab\n\nOpen `http://127.0.0.1:8889/lab?` in browser, input token(see docker start log) and set new password\n\nUse `docker stop jupyterlab-gpu` to stop server\nUse `docker start jupyterlab-gpu` to start service again\n\n\n\n### Install on local environment\n\nrefer to [tensorflow official website](https://tensorflow.google.cn/install/gpu)\n\n\n## License\n\nApache 2.0, see [LICENSE](LICENSE)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebduinoio%2Fmaix_train","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebduinoio%2Fmaix_train","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebduinoio%2Fmaix_train/lists"}