{"id":18280210,"url":"https://github.com/mlbo/tengine_c_classification_demo","last_synced_at":"2025-06-11T09:32:21.447Z","repository":{"id":118549072,"uuid":"383700921","full_name":"mlbo/Tengine_C_Classification_Demo","owner":"mlbo","description":null,"archived":false,"fork":false,"pushed_at":"2021-07-07T06:56:37.000Z","size":16128,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T04:49:43.054Z","etag":null,"topics":["c","classification","tengine"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mlbo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-07-07T06:45:28.000Z","updated_at":"2022-01-05T08:07:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"34fa7324-9c8b-450b-aa8b-c7e9390fb4b7","html_url":"https://github.com/mlbo/Tengine_C_Classification_Demo","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/mlbo%2FTengine_C_Classification_Demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlbo%2FTengine_C_Classification_Demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlbo%2FTengine_C_Classification_Demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlbo%2FTengine_C_Classification_Demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mlbo","download_url":"https://codeload.github.com/mlbo/Tengine_C_Classification_Demo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlbo%2FTengine_C_Classification_Demo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259238969,"owners_count":22826832,"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":["c","classification","tengine"],"created_at":"2024-11-05T12:33:47.809Z","updated_at":"2025-06-11T09:32:21.418Z","avatar_url":"https://github.com/mlbo.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tengine C Classification X86版本完整示例\n\n## 环境\n**System**: Ubuntu20.04\n\n**CMAKE**: 3.16.3\n\n## 准备\n\n1. 把[第0篇-Tengine X86版本编译](https://zhuanlan.zhihu.com/p/181579203)中编译好的so和头文件复制到项目目录中的tengine目录\n2. 把[Tengine/examples/common](https://github.com/OAID/Tengine/tree/tengine-lite/examples/common)中部分文件放入common目录\n3. 把[模型仓库](https://github.com/OAID/Tengine/tree/tengine-lite/examples#%E6%A8%A1%E5%9E%8B%E4%BB%93%E5%BA%93)的mobilenet.tmfile模型放到models目录，cat.jpg图片放到images目录\n4. 把[tm_classification.c](https://github.com/OAID/Tengine/blob/tengine-lite/examples/tm_classification.c)文件放到src目录\n\n此时目录结构应该是这样\n\n```\n├── images\n│   └── cat.jpg\n├── models\n│   └── mobilenet.tmfile\n├── src\n│   ├── common\n│   │   ├── common.h\n│   │   ├── stb_image.h\n│   │   ├── stb_image_write.h\n│   │   ├── tengine_operations.c\n│   │   └── tengine_operations.h\n│   └── tm_classification.c\n└── tengine\n    ├── include\n    │   └── tengine\n    │       ├── c_api.h\n    │       └── defines.h\n    └── lib\n        └── libtengine-lite.so\n```\n## 编写 CMakeLists.txt\n\n```cmake\ncmake_minimum_required(VERSION 3.10)\nproject(tm_classification)\n\nset(CMAKE_CXX_STANDARD 11)\n\ninclude_directories(tengine/include/ src/common/)\n\nadd_library(tengine SHARED IMPORTED)\nset_target_properties(tengine PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/tengine/lib/libtengine-lite.so)\n\nadd_executable(tm_classification src/tm_classification.c  \"src/common/tengine_operations.c\" )\n\ntarget_link_libraries(tm_classification -lm tengine)\n\n```\n\n## 编译\n\n```bash\nmkdir build\ncd build\ncmake ..\nmake -j`nproc`\n```\n\n## 测试\n\n```\n./build/tm_classification -m ./models/mobilenet.tmfile -i ./images/cat.jpg \n```\n输出\n```\nImage height not specified, use default 224\nImage width not specified, use default  224\nScale value not specified, use default  0.0, 0.0, 0.0\nMean value not specified, use default   104.0, 116.7, 122.7\ntengine-lite library version: 1.4-dev\n\nmodel file : ./models/mobilenet.tmfile\nimage file : ./imgs/cat.jpg\nimg_h, img_w, scale[3], mean[3] : 224 224 , 0.017 0.017 0.017, 104.0 116.7 122.7\nRepeat 1 times, thread 1, avg time 42.71 ms, max_time 42.71 ms, min_time 42.71 ms\n--------------------------------------\n8.574144, 282\n7.880117, 277\n7.812573, 278\n7.286458, 263\n6.357486, 281\n--------------------------------------\n```\n\n## 参考\n\n1. [Tengine 人脸检测X86版本](https://github.com/jiangzhongbo/Tengine_Tutorial/tree/master/2_FaceDetector)\n2. [https://github.com/OAID/Tengine](https://github.com/OAID/Tengine)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlbo%2Ftengine_c_classification_demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmlbo%2Ftengine_c_classification_demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlbo%2Ftengine_c_classification_demo/lists"}