[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-ahmetozlu--tensorflow_object_counting_api":3,"tool-ahmetozlu--tensorflow_object_counting_api":64},[4,17,27,35,43,56],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":16},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,3,"2026-04-05T11:01:52",[13,14,15],"开发框架","图像","Agent","ready",{"id":18,"name":19,"github_repo":20,"description_zh":21,"stars":22,"difficulty_score":23,"last_commit_at":24,"category_tags":25,"status":16},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",140436,2,"2026-04-05T23:32:43",[13,15,26],"语言模型",{"id":28,"name":29,"github_repo":30,"description_zh":31,"stars":32,"difficulty_score":23,"last_commit_at":33,"category_tags":34,"status":16},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107662,"2026-04-03T11:11:01",[13,14,15],{"id":36,"name":37,"github_repo":38,"description_zh":39,"stars":40,"difficulty_score":23,"last_commit_at":41,"category_tags":42,"status":16},3704,"NextChat","ChatGPTNextWeb\u002FNextChat","NextChat 是一款轻量且极速的 AI 助手，旨在为用户提供流畅、跨平台的大模型交互体验。它完美解决了用户在多设备间切换时难以保持对话连续性，以及面对众多 AI 模型不知如何统一管理的痛点。无论是日常办公、学习辅助还是创意激发，NextChat 都能让用户随时随地通过网页、iOS、Android、Windows、MacOS 或 Linux 端无缝接入智能服务。\n\n这款工具非常适合普通用户、学生、职场人士以及需要私有化部署的企业团队使用。对于开发者而言，它也提供了便捷的自托管方案，支持一键部署到 Vercel 或 Zeabur 等平台。\n\nNextChat 的核心亮点在于其广泛的模型兼容性，原生支持 Claude、DeepSeek、GPT-4 及 Gemini Pro 等主流大模型，让用户在一个界面即可自由切换不同 AI 能力。此外，它还率先支持 MCP（Model Context Protocol）协议，增强了上下文处理能力。针对企业用户，NextChat 提供专业版解决方案，具备品牌定制、细粒度权限控制、内部知识库整合及安全审计等功能，满足公司对数据隐私和个性化管理的高标准要求。",87618,"2026-04-05T07:20:52",[13,26],{"id":44,"name":45,"github_repo":46,"description_zh":47,"stars":48,"difficulty_score":23,"last_commit_at":49,"category_tags":50,"status":16},2268,"ML-For-Beginners","microsoft\u002FML-For-Beginners","ML-For-Beginners 是由微软推出的一套系统化机器学习入门课程，旨在帮助零基础用户轻松掌握经典机器学习知识。这套课程将学习路径规划为 12 周，包含 26 节精炼课程和 52 道配套测验，内容涵盖从基础概念到实际应用的完整流程，有效解决了初学者面对庞大知识体系时无从下手、缺乏结构化指导的痛点。\n\n无论是希望转型的开发者、需要补充算法背景的研究人员，还是对人工智能充满好奇的普通爱好者，都能从中受益。课程不仅提供了清晰的理论讲解，还强调动手实践，让用户在循序渐进中建立扎实的技能基础。其独特的亮点在于强大的多语言支持，通过自动化机制提供了包括简体中文在内的 50 多种语言版本，极大地降低了全球不同背景用户的学习门槛。此外，项目采用开源协作模式，社区活跃且内容持续更新，确保学习者能获取前沿且准确的技术资讯。如果你正寻找一条清晰、友好且专业的机器学习入门之路，ML-For-Beginners 将是理想的起点。",84991,"2026-04-05T10:45:23",[14,51,52,53,15,54,26,13,55],"数据工具","视频","插件","其他","音频",{"id":57,"name":58,"github_repo":59,"description_zh":60,"stars":61,"difficulty_score":10,"last_commit_at":62,"category_tags":63,"status":16},3128,"ragflow","infiniflow\u002Fragflow","RAGFlow 是一款领先的开源检索增强生成（RAG）引擎，旨在为大语言模型构建更精准、可靠的上下文层。它巧妙地将前沿的 RAG 技术与智能体（Agent）能力相结合，不仅支持从各类文档中高效提取知识，还能让模型基于这些知识进行逻辑推理和任务执行。\n\n在大模型应用中，幻觉问题和知识滞后是常见痛点。RAGFlow 通过深度解析复杂文档结构（如表格、图表及混合排版），显著提升了信息检索的准确度，从而有效减少模型“胡编乱造”的现象，确保回答既有据可依又具备时效性。其内置的智能体机制更进一步，使系统不仅能回答问题，还能自主规划步骤解决复杂问题。\n\n这款工具特别适合开发者、企业技术团队以及 AI 研究人员使用。无论是希望快速搭建私有知识库问答系统，还是致力于探索大模型在垂直领域落地的创新者，都能从中受益。RAGFlow 提供了可视化的工作流编排界面和灵活的 API 接口，既降低了非算法背景用户的上手门槛，也满足了专业开发者对系统深度定制的需求。作为基于 Apache 2.0 协议开源的项目，它正成为连接通用大模型与行业专有知识之间的重要桥梁。",77062,"2026-04-04T04:44:48",[15,14,13,26,54],{"id":65,"github_repo":66,"name":67,"description_en":68,"description_zh":69,"ai_summary_zh":69,"readme_en":70,"readme_zh":71,"quickstart_zh":72,"use_case_zh":73,"hero_image_url":74,"owner_login":75,"owner_name":76,"owner_avatar_url":77,"owner_bio":78,"owner_company":79,"owner_location":80,"owner_email":81,"owner_twitter":79,"owner_website":82,"owner_url":83,"languages":84,"stars":89,"forks":90,"last_commit_at":91,"license":92,"difficulty_score":93,"env_os":94,"env_gpu":95,"env_ram":94,"env_deps":96,"category_tags":104,"github_topics":105,"view_count":23,"oss_zip_url":79,"oss_zip_packed_at":79,"status":16,"created_at":126,"updated_at":127,"faqs":128,"releases":164},3356,"ahmetozlu\u002Ftensorflow_object_counting_api","tensorflow_object_counting_api","🚀 The TensorFlow Object Counting API is an open source framework built on top of TensorFlow and Keras that makes it easy to develop object counting systems!","tensorflow_object_counting_api 是一个基于 TensorFlow 和 Keras 构建的开源框架，旨在帮助开发者轻松搭建高效的物体计数系统。它主要解决了在视频流或静态图像中自动识别并统计特定目标数量的技术难题，广泛适用于人流监控、车辆统计、生产线质检等场景。\n\n该工具非常适合具备一定编程基础的 AI 开发者、研究人员以及需要快速原型验证的工程团队使用。其核心亮点在于提供了多种灵活的工作模式：既支持实时动态计数和累计计数，也集成了高精度的物体追踪功能，能够持续锁定移动目标以防重复统计。此外，它还兼容 Mask R-CNN 架构，不仅能计数，还能实现精细的实例分割。\n\n对于有特殊需求的用户，tensorflow_object_counting_api 支持自定义训练模式。用户可以利用迁移学习技术，使用自己的数据集训练模型，从而打造出能识别蓝精灵、意大利面等独特目标的专用计数器。作为一个持续更新的项目，它致力于在保持高性能的同时，让物体计数系统的开发变得更加轻量与便捷。","# TensorFlow Object Counting API\nThe TensorFlow Object Counting API is an open source framework built on top of TensorFlow and Keras that makes it easy to develop object counting systems. ***Please contact if you need professional object detection & tracking & counting project with the super high accuracy and reliability!***\n\n## QUICK DEMO\n\n---\n### Cumulative Counting Mode (TensorFlow implementation):\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_21a0dc4076d2.gif\" | width=418> \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_987e7c37fa0c.gif\" | width=400>\n\u003C\u002Fp>\n\n---\n### Real-Time Counting Mode (TensorFlow implementation):\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_26aa608b9c1e.gif\" | width=410> \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_7e0c86af07d8.gif\" | width=410>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_fc18bef174ca.gif\" | width=410>\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_82512f847eef.gif\" | width=410>\n\u003C\u002Fp>\n\n---\n\n---\n### Object Tracking Mode (TensorFlow implementation):\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_28742c99ab54.gif\" | width=410> \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_579ead17c2fd.gif\" | width=410>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_4c196e7fa0c3.gif\" | width=825>\n\u003C\u002Fp>\n\n- Tracking module was built on top of [this approach](https:\u002F\u002Fgithub.com\u002Fkcg2015\u002FVehicle-Detection-and-Tracking).\n\n---\n\n### Object Counting On Single Image (TensorFlow implementation):\n\u003Cp align=\"center\">\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_7b17e0b1cf68.png\" | width=750>\u003C\u002Fp>\n\n---\n\n### Object Counting based R-CNN ([Keras and TensorFlow implementation](https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Ftensorflow_object_counting_api\u002Ftree\u002Fmaster\u002Fmask_rcnn_counting_api)):\n\n\u003Cp align=\"center\">\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_55893de9d2d2.png\" | width=750>\u003C\u002Fp>\n\n### Object Segmentation & Counting based Mask R-CNN ([Keras and TensorFlow implementation](https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Ftensorflow_object_counting_api\u002Ftree\u002Fmaster\u002Fmask_rcnn_counting_api)):\n\n\u003Cp align=\"center\">\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_55b830026db1.png\" | width=750>\u003C\u002Fp>\n\n---\n\n### BONUS: Custom Object Counting Mode (TensorFlow implementation):\n\nYou can train TensorFlow models with your own training data to built your own custom object counter system! If you want to learn how to do it, please check one of the sample projects, which cover some of the theory of transfer learning and show how to apply it in useful projects, are given at below.\n\n**Sample Project#1: Smurf Counting**\n\nMore info can be found in [**here**](https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Ftensorflow_object_counting_api\u002Ftree\u002Fmaster\u002Fsmurf_counter_training)!\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_f5631cf31133.gif\" | width=750>\n\u003C\u002Fp>\n\n**Sample Project#2: Barilla-Spaghetti Counting**\n\nMore info can be found in [**here**](https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Ftensorflow_object_counting_api\u002Ftree\u002Fmaster\u002Fmask_rcnn_counting_api_keras_tensorflow\u002Fbarilla_spaghetti_counter_training)!\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_d672d49d40b3.png\" | width=750>  \n\u003C\u002Fp>\n\n---\n\n***The development is on progress! The API will be updated soon, the more talented and light-weight API will be available in this repo!***\n\n- ***Detailed API documentation and sample jupyter notebooks that explain basic usages of API will be added!***\n\n**You can find a sample project - case study that uses TensorFlow Object Counting API in [*this repo*](https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Fvehicle_counting_tensorflow).**\n\n---\n\n## USAGE\n\n### 1.) Usage of \"Cumulative Counting Mode\"\n\n#### 1.1) For detecting, tracking and counting *the pedestrians* with disabled color prediction\n\n*Usage of \"Cumulative Counting Mode\" for the \"pedestrian counting\" case:*\n\n    is_color_recognition_enabled = False # set it to true for enabling the color prediction for the detected objects\n    roi = 385 # roi line position\n    deviation = 1 # the constant that represents the object counting area\n\n    object_counting_api.cumulative_object_counting_x_axis(input_video, detection_graph, category_index, is_color_recognition_enabled, roi, deviation) # counting all the objects\n    \n*Result of the \"pedestrian counting\" case:*\n \n \u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_987e7c37fa0c.gif\" | width=700>\n\u003C\u002Fp>\n\n---\n\n**Source code of \"pedestrian counting case-study\": [pedestrian_counting.py](https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Ftensorflow_object_counting_api\u002Fblob\u002Fmaster\u002Fpedestrian_counting.py)**\n\n---\n\n**1.2)** For detecting, tracking and counting *the vehicles* with enabled color prediction\n\n*Usage of \"Cumulative Counting Mode\" for the \"vehicle counting\" case:*\n\n    is_color_recognition_enabled = True # set it to true for enabling the color prediction for the detected objects\n    roi = 200 # roi line position\n    deviation = 3 # the constant that represents the object counting area\n\n    object_counting_api.cumulative_object_counting_y_axis(input_video, detection_graph, category_index, is_color_recognition_enabled, roi, deviation) # counting all the objects\n    \n*Result of the \"vehicle counting\" case:*\n \n \u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_c208bb0cb228.gif\" | width=700>\n\u003C\u002Fp>\n\n---\n\n**Source code of \"vehicle counting case-study\": [vehicle_counting.py](https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Ftensorflow_object_counting_api\u002Fblob\u002Fmaster\u002Fvehicle_counting.py)**\n\n---\n\n### 2.) Usage of \"Real-Time Counting Mode\"\n\n#### 2.1) For detecting, tracking and counting the *targeted object\u002Fs* with disabled color prediction\n \n *Usage of \"the targeted object is bicycle\":*\n \n    is_color_recognition_enabled = False # set it to true for enabling the color prediction for the detected objects\n    targeted_objects = \"bicycle\" \n\n    object_counting_api.targeted_object_counting(input_video, detection_graph, category_index, is_color_recognition_enabled, targeted_objects) # targeted objects counting\n    \n *Result of \"the targeted object is bicycle\":*\n \n \u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_fce5533cf384.gif\" | width=700>\n\u003C\u002Fp>\n\n*Usage of \"the targeted object is person\":*\n\n    is_color_recognition_enabled = False # set it to true for enabling the color prediction for the detected objects\n    targeted_objects = \"person\"\n\n    object_counting_api.targeted_object_counting(input_video, detection_graph, category_index, is_color_recognition_enabled, targeted_objects) # targeted objects counting\n \n *Result of \"the targeted object is person\":*\n\n \u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_e103daafc529.gif\" | width=700>\n\u003C\u002Fp>\n\n*Usage of \"detecting, counting and tracking all the objects\":*\n\n    is_color_recognition_enabled = False # set it to true for enabling the color prediction for the detected objects\n\n    object_counting_api.object_counting(input_video, detection_graph, category_index, is_color_recognition_enabled) # counting all the objects\n \n *Result of \"detecting, counting and tracking all the objects\":*\n\n \u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_421976dc9801.gif\" | width=700>\n\u003C\u002Fp>\n\n---\n*Usage of \"detecting, counting and tracking **the multiple targeted objects**\":*\n\n    targeted_objects = \"person, bicycle\" # (for counting targeted objects) change it with your targeted objects\n    is_color_recognition_enabled = False # set it to true for enabling the color prediction for the detected objects\n\n    object_counting_api.targeted_object_counting(input_video, detection_graph, category_index, is_color_recognition_enabled, targeted_objects) # targeted objects counting\n---\n \n#### 2.2) For detecting, tracking and counting \"all the objects with disabled color prediction\"\n\n*Usage of detecting, counting and tracking \"all the objects with disabled color prediction\":*\n    \n    is_color_recognition_enabled = False # set it to true for enabling the color prediction for the detected objects\n\n    object_counting_api.object_counting(input_video, detection_graph, category_index, is_color_recognition_enabled) # counting all the objects\n    \n *Result of detecting, counting and tracking \"all the objects with disabled color prediction\":*\n\n \u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Fuser-images.githubusercontent.com\u002F22610163\u002F42411748-1a5ab49c-820a-11e8-8648-d78ffa08c28c.gif\" | width=700>\n\u003C\u002Fp>\n\n\n*Usage of detecting, counting and tracking \"all the objects with enabled color prediction\":*\n\n    is_color_recognition_enabled = True # set it to true for enabling the color prediction for the detected objects\n\n    object_counting_api.object_counting(input_video, detection_graph, category_index, is_color_recognition_enabled) # counting all the objects\n    \n *Result of detecting, counting and tracking \"all the objects with enabled color prediction\":*\n\n \u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_0df6350a2c13.gif\" | width=700>\n\u003C\u002Fp>\n\n### 3.) Usage of \"Object Tracking Mode\"\n\nJust run [object_tracking.py](https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Ftensorflow_object_counting_api\u002Fblob\u002Fmaster\u002Fobject_tracking.py)\n\n---\n\n**For sample usages of \"Real-Time Counting Mode\": [real_time_counting.py](https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Ftensorflow_object_counting_api\u002Fblob\u002Fmaster\u002Freal_time_counting.py)**\n\n---\n\n*The minimum object detection threshold can be set [in this line](https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Ftensorflow_object_counting_api\u002Fblob\u002Fmaster\u002Futils\u002Fvisualization_utils.py#L443) in terms of percentage. The default minimum object detecion threshold is 0.5!*\n\n## General Capabilities of The TensorFlow Object Counting API\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_b0d68b2d0221.jpg\" | width = 720>\n\u003C\u002Fp>\n\nHere are some cool capabilities of TensorFlow Object Counting API:\n\n- Detect just the targeted objects\n- Detect all the objects\n- Count just the targeted objects\n- Count all the objects\n- Predict color of the targeted objects\n- Predict color of all the objects\n- Predict speed of the targeted objects\n- Predict speed of all the objects\n- Print out the detection-counting result in a .csv file as an analysis report\n- Save and store detected objects as new images under [detected_object folder](www)\n- Select, download and use state of the art [models that are trained by Google Brain Team](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Fmodels\u002Fblob\u002Fmaster\u002Fresearch\u002Fobject_detection\u002Fg3doc\u002Fdetection_model_zoo.md)\n- Use [your own trained models](https:\u002F\u002Fwww.tensorflow.org\u002Fguide\u002Fkeras) or [a fine-tuned model](https:\u002F\u002Fgithub.com\u002FHvass-Labs\u002FTensorFlow-Tutorials\u002Fblob\u002Fmaster\u002F10_Fine-Tuning.ipynb) to detect spesific object\u002Fs\n- Save detection and counting results as a new video or show detection and counting results in real time\n- Process images or videos depending on your requirements\n\nHere are some cool architectural design features of TensorFlow Object Counting API:\n\n- Lightweigth, runs in real-time\n- Scalable and well-designed framework, easy usage\n- Gets \"Pythonic Approach\" advantages\n- It supports REST Architecture and RESTful Web Services\n\nTODOs:\n\n- TensorFlox2.x support will be provided.\n- Autonomus Training Image Annotation Tool will be developed.\n- GUI will be developed.\n\n## Theory\n\n### System Architecture\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_06c8e1dbbb22.jpg\" | width=720>\n\u003C\u002Fp>\n\n- Object detection and classification have been developed on top of TensorFlow Object Detection API, [see](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Fmodels\u002Ftree\u002Fmaster\u002Fresearch\u002Fobject_detection) for more info.\n\n- Object color prediction has been developed using OpenCV via K-Nearest Neighbors Machine Learning Classification Algorithm is Trained Color Histogram Features, [see](https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Ftensorflow_object_counting_api\u002Ftree\u002Fmaster\u002Futils\u002Fcolor_recognition_module) for more info.\n\n[TensorFlow™](https:\u002F\u002Fwww.tensorflow.org\u002F) is an open source software library for numerical computation using data flow graphs. Nodes in the graph represent mathematical operations, while the graph edges represent the multidimensional data arrays (tensors) communicated between them.\n\n[OpenCV (Open Source Computer Vision Library)](https:\u002F\u002Fopencv.org\u002Fabout.html) is an open source computer vision and machine learning software library. OpenCV was built to provide a common infrastructure for computer vision applications and to accelerate the use of machine perception in the commercial products.\n\n### Tracker\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_3c81d7ea3ad9.png\" | width=700>\n\u003C\u002Fp>\n\nSource video is read frame by frame with OpenCV. Each frames is processed by [\"SSD with Mobilenet\" model](http:\u002F\u002Fdownload.tensorflow.org\u002Fmodels\u002Fobject_detection\u002Fssd_mobilenet_v1_coco_2017_11_17) is developed on TensorFlow. This is a loop that continue working till reaching end of the video. The main pipeline of the tracker is given at the above Figure.\n\n### Models\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_516818984034.png\">\n\u003C\u002Fp>\n\nBy default I use an [\"SSD with Mobilenet\" model](http:\u002F\u002Fdownload.tensorflow.org\u002Fmodels\u002Fobject_detection\u002Fssd_mobilenet_v1_coco_2017_11_17) in this project. You can find more information about SSD in [here](https:\u002F\u002Ftowardsdatascience.com\u002Funderstanding-ssd-multibox-real-time-object-detection-in-deep-learning-495ef744fab). \n\nPlease, See the [detection model zoo](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Fmodels\u002Fblob\u002Fmaster\u002Fresearch\u002Fobject_detection\u002Fg3doc\u002Fdetection_model_zoo.md) for a list of other models that can be run out-of-the-box with varying speeds and accuracies. You can easily select, download and use state-of-the-art models that are suitable for your requeirements using TensorFlow Object Detection API.\n\nYou can perform transfer learning on trained TensorFlow models to build your custom object counting systems!\n\n## Project Demo\n\nDemo video of the project is available on [My YouTube Channel](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=bas6c8d1JyU).\n\n## Installation\n\n### Dependencies\n\nTensorflow Object Counting API depends on the following libraries (see [requirements.txt]()):\n\n- [TensorFlow Object Detection API](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Fmodels\u002Ftree\u002Fmaster\u002Fresearch\u002Fobject_detection)\n- **tensorflow==1.5.0**\n- **keras==2.0.8**\n- **opencv-python==4.4.0.42**\n- Protobuf 3.0.0\n- Python-tk\n- Pillow 1.0\n- lxml\n- tf Slim (which is included in the \"tensorflow\u002Fmodels\u002Fresearch\u002F\" checkout)\n- Jupyter notebook\n- Matplotlib\n- Cython\n- contextlib2\n- cocoapi\n\nFor detailed steps to install Tensorflow, follow the [Tensorflow installation instructions](https:\u002F\u002Fwww.tensorflow.org\u002Finstall\u002F). \n\nTensorFlow Object Detection API have to be installed to run TensorFlow Object Counting API, for more information, please see [this](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Fmodels\u002Fblob\u002Fmaster\u002Fresearch\u002Fobject_detection\u002Fg3doc\u002Finstallation.md).\n\n### Important: Compatibility problems caused by TensorFlow2 version.\n\nThis project developed with TensorFlow 1.5.0 version. If you need to run this project with TensorFlow 2.x version, just replace tensorflow imports with tensorflow.compat.v1, and add tf.disable_v2_behavior that's all. \n\nInstead of this import statement:\n\n    import tensorflow\n\nuse this:\n\n    import tensorflow.compat.v1 as tf\n    tf.disable_v2_behavior()\n\n## Citation\nIf you use this code for your publications, please cite it as:\n\n    @ONLINE{\n        author = \"Ahmet Özlü\",\n        title  = \"TensorFlow Object Counting API\",\n        year   = \"2018\",\n        url    = \"https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Ftensorflow_object_counting_api\"\n    }\n\n## Author\nAhmet Özlü\n\n## License\nThis system is available under the MIT license. See the LICENSE file for more info.\n","# TensorFlow 物体计数 API\nTensorFlow 物体计数 API 是一个基于 TensorFlow 和 Keras 构建的开源框架，能够轻松开发物体计数系统。***如需超高精度和可靠性的专业物体检测、跟踪与计数项目，请联系我们！***\n\n## 快速演示\n\n---\n### 累计计数模式（TensorFlow 实现）：\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_21a0dc4076d2.gif\" | width=418> \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_987e7c37fa0c.gif\" | width=400>\n\u003C\u002Fp>\n\n---\n### 实时计数模式（TensorFlow 实现）：\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_26aa608b9c1e.gif\" | width=410> \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_7e0c86af07d8.gif\" | width=410>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_fc18bef174ca.gif\" | width=410>\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_82512f847eef.gif\" | width=410>\n\u003C\u002Fp>\n\n---\n\n---\n### 物体跟踪模式（TensorFlow 实现）：\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_28742c99ab54.gif\" | width=410> \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_579ead17c2fd.gif\" | width=410>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_4c196e7fa0c3.gif\" | width=825>\n\u003C\u002Fp>\n\n- 跟踪模块基于[这种方法](https:\u002F\u002Fgithub.com\u002Fkcg2015\u002FVehicle-Detection-and-Tracking)构建。\n\n---\n\n### 单张图像上的物体计数（TensorFlow 实现）：\n\u003Cp align=\"center\">\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_7b17e0b1cf68.png\" | width=750>\u003C\u002Fp>\n\n---\n\n### 基于 R-CNN 的物体计数（[Keras 和 TensorFlow 实现](https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Ftensorflow_object_counting_api\u002Ftree\u002Fmaster\u002Fmask_rcnn_counting_api))：\n\n\u003Cp align=\"center\">\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_55893de9d2d2.png\" | width=750>\u003C\u002Fp>\n\n### 基于 Mask R-CNN 的物体分割与计数（[Keras 和 TensorFlow 实现](https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Ftensorflow_object_counting_api\u002Ftree\u002Fmaster\u002Fmask_rcnn_counting_api))：\n\n\u003Cp align=\"center\">\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_55b830026db1.png\" | width=750>\u003C\u002Fp>\n\n---\n\n### 附加：自定义物体计数模式（TensorFlow 实现）：\n\n您可以通过自己的训练数据来训练 TensorFlow 模型，从而构建属于您自己的自定义物体计数系统！如果您想了解如何操作，请查看以下示例项目，这些项目涵盖了迁移学习的一些理论知识，并展示了如何将其应用于实际项目中。\n\n**示例项目#1：蓝精灵计数**\n\n更多信息请参见[**这里**](https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Ftensorflow_object_counting_api\u002Ftree\u002Fmaster\u002Fsmurf_counter_training)！\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_f5631cf31133.gif\" | width=750>\n\u003C\u002Fp>\n\n**示例项目#2：百乐面计数**\n\n更多信息请参见[**这里**](https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Ftensorflow_object_counting_api\u002Ftree\u002Fmaster\u002Fmask_rcnn_counting_api_keras_tensorflow\u002Fbarilla_spaghetti_counter_training)！\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_d672d49d40b3.png\" | width=750>  \n\u003C\u002Fp>\n\n---\n\n***开发工作正在进行中！该 API 将很快更新，届时将推出更强大且轻量级的版本！***\n\n- ***详细的 API 文档和讲解 API 基本用法的 Jupyter 笔记本将陆续添加！***\n\n**您可以在[*这个仓库*](https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Fvehicle_counting_tensorflow)中找到一个使用 TensorFlow 物体计数 API 的案例研究项目。**\n\n---\n\n## 使用方法\n\n### 1.) “累计计数模式”的使用\n\n#### 1.1) 用于检测、跟踪和计数*行人*，并禁用颜色识别功能\n\n*“累计计数模式”在“行人计数”场景中的使用：*\n\n    is_color_recognition_enabled = False # 设置为 True 可启用对检测到的物体的颜色预测\n    roi = 385 # ROI 线位置\n    deviation = 1 # 表示物体计数区域的常数\n\n    object_counting_api.cumulative_object_counting_x_axis(input_video, detection_graph, category_index, is_color_recognition_enabled, roi, deviation) # 计算所有物体\n    \n*“行人计数”场景的结果：*\n \n \u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_987e7c37fa0c.gif\" | width=700>\n\u003C\u002Fp>\n\n---\n\n**“行人计数”案例研究的源代码：[pedestrian_counting.py](https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Ftensorflow_object_counting_api\u002Fblob\u002Fmaster\u002Fpedestrian_counting.py)**\n\n---\n\n**1.2)** 用于检测、跟踪和计数*车辆*，并启用颜色识别功能\n\n*“累计计数模式”在“车辆计数”场景中的使用：*\n\n    is_color_recognition_enabled = True # 设置为 True 可启用对检测到的物体的颜色预测\n    roi = 200 # ROI 线位置\n    deviation = 3 # 表示物体计数区域的常数\n\n    object_counting_api.cumulative_object_counting_y_axis(input_video, detection_graph, category_index, is_color_recognition_enabled, roi, deviation) # 计算所有物体\n    \n*“车辆计数”场景的结果：*\n \n \u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_c208bb0cb228.gif\" | width=700>\n\u003C\u002Fp>\n\n---\n\n**“车辆计数”案例研究的源代码：[vehicle_counting.py](https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Ftensorflow_object_counting_api\u002Fblob\u002Fmaster\u002Fvehicle_counting.py)**\n\n---\n\n### 2.) “实时计数模式”的使用方法\n\n#### 2.1) 在禁用颜色预测的情况下检测、跟踪并计数*目标物体*\n\n *“目标物体为自行车”的使用方法：*\n \n    is_color_recognition_enabled = False # 设置为True以启用对检测到的物体的颜色预测\n    targeted_objects = \"bicycle\" \n\n    object_counting_api.targeted_object_counting(input_video, detection_graph, category_index, is_color_recognition_enabled, targeted_objects) # 目标物体计数\n    \n *“目标物体为自行车”的结果：*\n \n \u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_fce5533cf384.gif\" | width=700>\n\u003C\u002Fp>\n\n*“目标物体为人”的使用方法：*\n\n    is_color_recognition_enabled = False # 设置为True以启用对检测到的物体的颜色预测\n    targeted_objects = \"person\"\n\n    object_counting_api.targeted_object_counting(input_video, detection_graph, category_index, is_color_recognition_enabled, targeted_objects) # 目标物体计数\n \n *“目标物体为人”的结果：*\n\n \u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_e103daafc529.gif\" | width=700>\n\u003C\u002Fp>\n\n*“检测、计数和跟踪所有物体”的使用方法：*\n\n    is_color_recognition_enabled = False # 设置为True以启用对检测到的物体的颜色预测\n\n    object_counting_api.object_counting(input_video, detection_graph, category_index, is_color_recognition_enabled) # 计数所有物体\n \n *“检测、计数和跟踪所有物体”的结果：*\n\n \u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_421976dc9801.gif\" | width=700>\n\u003C\u002Fp>\n\n---\n*“检测、计数和跟踪**多个目标物体**”的使用方法：*\n\n    targeted_objects = \"person, bicycle\" # （用于计数目标物体）请根据您的需求更改目标物体\n    is_color_recognition_enabled = False # 设置为True以启用对检测到的物体的颜色预测\n\n    object_counting_api.targeted_object_counting(input_video, detection_graph, category_index, is_color_recognition_enabled, targeted_objects) # 目标物体计数\n---\n \n#### 2.2) 在禁用颜色预测的情况下检测、跟踪并计数“所有物体”\n\n*“禁用颜色预测的情况下检测、计数和跟踪所有物体”的使用方法：*\n    \n    is_color_recognition_enabled = False # 设置为True以启用对检测到的物体的颜色预测\n\n    object_counting_api.object_counting(input_video, detection_graph, category_index, is_color_recognition_enabled) # 计数所有物体\n    \n *“禁用颜色预测的情况下检测、计数和跟踪所有物体”的结果：*\n\n \u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_3a0388cc3ef5.gif\" | width=700>\n\u003C\u002Fp>\n\n\n*“启用颜色预测的情况下检测、计数和跟踪所有物体”的使用方法：*\n\n    is_color_recognition_enabled = True # 设置为True以启用对检测到的物体的颜色预测\n\n    object_counting_api.object_counting(input_video, detection_graph, category_index, is_color_recognition_enabled) # 计数所有物体\n    \n *“启用颜色预测的情况下检测、计数和跟踪所有物体”的结果：*\n\n \u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_0df6350a2c13.gif\" | width=700>\n\u003C\u002Fp>\n\n### 3.) “物体跟踪模式”的使用方法\n\n只需运行[object_tracking.py](https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Ftensorflow_object_counting_api\u002Fblob\u002Fmaster\u002Fobject_tracking.py)\n\n---\n\n**“实时计数模式”的示例用法：[real_time_counting.py](https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Ftensorflow_object_counting_api\u002Fblob\u002Fmaster\u002Freal_time_counting.py)**\n\n---\n\n*最小物体检测阈值可以在[这一行](https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Ftensorflow_object_counting_api\u002Fblob\u002Fmaster\u002Futils\u002Fvisualization_utils.py#L443)中以百分比形式设置。默认的最小物体检测阈值是0.5！*\n\n## TensorFlow 物体计数 API 的通用功能\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_b0d68b2d0221.jpg\" | width = 720>\n\u003C\u002Fp>\n\n以下是 TensorFlow 物体计数 API 的一些强大功能：\n\n- 只检测目标物体\n- 检测所有物体\n- 只计数目标物体\n- 计数所有物体\n- 预测目标物体的颜色\n- 预测所有物体的颜色\n- 预测目标物体的速度\n- 预测所有物体的速度\n- 将检测和计数结果以 .csv 文件的形式输出为分析报告\n- 将检测到的物体保存为新图像，并存储在 [detected_object 文件夹](www) 中\n- 选择、下载并使用由 Google Brain 团队训练的先进模型\n- 使用您自己训练的模型或微调后的模型来检测特定物体\n- 将检测和计数结果保存为新视频，或实时显示检测和计数结果\n- 根据您的需求处理图像或视频\n\n以下是 TensorFlow 物体计数 API 的一些优秀架构设计特点：\n\n- 轻量级，可实时运行\n- 可扩展且设计精良的框架，易于使用\n- 具备 Python 式编程的优势\n- 支持 REST 架构和 RESTful Web 服务\n\n待办事项：\n\n- 将提供 TensorFlox2.x 支持。\n- 将开发自主训练的图像标注工具。\n- 将开发图形用户界面。\n\n## 理论\n\n### 系统架构\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_06c8e1dbbb22.jpg\" | width=720>\n\u003C\u002Fp>\n\n- 物体检测与分类是在 TensorFlow 对象检测 API 的基础上开发的，更多信息请参阅 [此处](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Fmodels\u002Ftree\u002Fmaster\u002Fresearch\u002Fobject_detection)。\n\n- 物体颜色预测则是利用 OpenCV 结合 K 近邻机器学习分类算法，并基于颜色直方图特征进行训练实现的，更多信息请参阅 [此处](https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Ftensorflow_object_counting_api\u002Ftree\u002Fmaster\u002Futils\u002Fcolor_recognition_module)。\n\n[TensorFlow™](https:\u002F\u002Fwww.tensorflow.org\u002F) 是一个开源的数值计算软件库，采用数据流图的方式进行运算。图中的节点代表数学运算，而边则表示在节点之间传递的多维数据数组（张量）。\n\n[OpenCV（开源计算机视觉库）](https:\u002F\u002Fopencv.org\u002Fabout.html) 是一个开源的计算机视觉和机器学习软件库。OpenCV 的设计初衷是为计算机视觉应用提供通用的基础架构，并加速机器感知技术在商业产品中的应用。\n\n### 跟踪器\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_3c81d7ea3ad9.png\" | width=700>\n\u003C\u002Fp>\n\n源视频通过 OpenCV 逐帧读取。每一帧都由基于 TensorFlow 开发的 [\"SSD with Mobilenet\" 模型](http:\u002F\u002Fdownload.tensorflow.org\u002Fmodels\u002Fobject_detection\u002Fssd_mobilenet_v1_coco_2017_11_17)进行处理。这一过程会持续循环，直到视频结束。跟踪器的主要流程如上图所示。\n\n### 模型\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_readme_516818984034.png\">\n\u003C\u002Fp>\n\n默认情况下，本项目使用的是 [\"SSD with Mobilenet\" 模型](http:\u002F\u002Fdownload.tensorflow.org\u002Fmodels\u002Fobject_detection\u002Fssd_mobilenet_v1_coco_2017_11_17)。关于 SSD 的更多信息，请参阅 [这篇博客文章](https:\u002F\u002Ftowardsdatascience.com\u002Funderstanding-ssd-multibox-real-time-object-detection-in-deep-learning-495ef744fab)。\n\n有关其他可直接运行、速度和精度各异的模型列表，请参阅 [检测模型动物园](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Fmodels\u002Fblob\u002Fmaster\u002Fresearch\u002Fobject_detection\u002Fg3doc\u002Fdetection_model_zoo.md)。您可以使用 TensorFlow 对象检测 API 轻松选择、下载并使用适合您需求的最先进模型。\n\n您还可以对已训练好的 TensorFlow 模型进行迁移学习，以构建自定义的对象计数系统！\n\n## 项目演示\n\n项目的演示视频已在我的 YouTube 频道上发布，链接为 [这里](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=bas6c8d1JyU)。\n\n## 安装\n\n### 依赖项\n\nTensorFlow 对象计数 API 依赖于以下库（详见 [requirements.txt]())：\n\n- [TensorFlow 对象检测 API](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Fmodels\u002Ftree\u002Fmaster\u002Fresearch\u002Fobject_detection)\n- **tensorflow==1.5.0**\n- **keras==2.0.8**\n- **opencv-python==4.4.0.42**\n- Protobuf 3.0.0\n- Python-tk\n- Pillow 1.0\n- lxml\n- tf Slim（包含在 \"tensorflow\u002Fmodels\u002Fresearch\u002F\" 代码库中）\n- Jupyter notebook\n- Matplotlib\n- Cython\n- contextlib2\n- cocoapi\n\n有关 TensorFlow 的详细安装步骤，请参考 [TensorFlow 安装指南](https:\u002F\u002Fwww.tensorflow.org\u002Finstall\u002F)。\n\n要运行 TensorFlow 对象计数 API，必须先安装 TensorFlow 对象检测 API，更多信息请参阅 [此文档](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Fmodels\u002Fblob\u002Fmaster\u002Fresearch\u002Fobject_detection\u002Fg3doc\u002Finstallation.md)。\n\n### 重要提示：TensorFlow 2.x 版本可能引发的兼容性问题\n\n本项目是基于 TensorFlow 1.5.0 版本开发的。如果您需要使用 TensorFlow 2.x 版本来运行该项目，只需将所有 `tensorflow` 导入语句替换为 `tensorflow.compat.v1`，并在代码开头添加 `tf.disable_v2_behavior()` 即可。\n\n例如，将原来的导入语句：\n\n    import tensorflow\n\n替换为：\n\n    import tensorflow.compat.v1 as tf\n    tf.disable_v2_behavior()\n\n## 引用\n如果您在论文或其他出版物中使用了本代码，请按以下格式引用：\n\n    @ONLINE{\n        author = \"Ahmet Özlü\",\n        title  = \"TensorFlow 对象计数 API\",\n        year   = \"2018\",\n        url    = \"https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Ftensorflow_object_counting_api\"\n    }\n\n## 作者\nAhmet Özlü\n\n## 许可证\n本系统采用 MIT 许可证授权。更多详情请参阅 LICENSE 文件。","# TensorFlow Object Counting API 快速上手指南\n\nTensorFlow Object Counting API 是一个基于 TensorFlow 和 Keras 构建的开源框架，旨在帮助开发者轻松构建物体检测、跟踪与计数系统。它支持累计计数、实时计数、特定目标计数及颜色预测等功能。\n\n## 1. 环境准备\n\n在开始之前，请确保您的开发环境满足以下要求：\n\n*   **操作系统**: Linux, macOS 或 Windows\n*   **Python 版本**: Python 3.6 - 3.8 (推荐)\n*   **核心依赖**:\n    *   TensorFlow (GPU 或 CPU 版本)\n    *   Keras\n    *   OpenCV (`opencv-python`)\n    *   NumPy\n    *   Pillow\n    *   Matplotlib\n\n**前置检查：**\n确保已安装 CUDA 和 cuDNN（如果使用 GPU 加速）。\n\n## 2. 安装步骤\n\n### 2.1 克隆项目\n首先从 GitHub 克隆仓库到本地：\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Ftensorflow_object_counting_api.git\ncd tensorflow_object_counting_api\n```\n\n### 2.2 安装依赖\n建议使用虚拟环境（如 `venv` 或 `conda`）以避免依赖冲突。\n\n**使用 pip 安装基础依赖：**\n```bash\npip install -r requirements.txt\n```\n*(注：如果项目中没有 `requirements.txt`，请手动安装核心库)*\n```bash\npip install tensorflow opencv-python numpy pillow matplotlib scipy\n```\n\n**国内加速方案：**\n如果您在中国大陆，推荐使用清华源或阿里源加速安装：\n```bash\npip install -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple tensorflow opencv-python numpy pillow matplotlib scipy\n```\n\n### 2.3 下载预训练模型\n该 API 需要加载预训练的 TensorFlow 检测图（Detection Graph）。\n1. 访问 [TensorFlow Detection Model Zoo](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Fmodels\u002Fblob\u002Fmaster\u002Fresearch\u002Fobject_detection\u002Fg3doc\u002Fdetection_model_zoo.md)。\n2. 下载一个适合的模型（例如 `ssd_mobilenet_v1_coco_2018_01_28.tar.gz`）。\n3. 解压并将 `.pb` 文件（通常是 `frozen_inference_graph.pb`）放置在项目目录或代码指定的路径下。\n4. 确保 `category_index` 变量对应您下载的模型类别（通常使用 COCO 数据集索引）。\n\n## 3. 基本使用\n\n以下是三种最常用的计数模式示例。请确保将 `input_video` 替换为您的视频文件路径，并正确加载 `detection_graph` 和 `category_index`。\n\n### 3.1 累计计数模式 (Cumulative Counting Mode)\n适用于统计穿过某条线的物体总数（如人流统计、车流统计）。\n\n```python\nimport object_counting_api\n\n# 配置参数\nis_color_recognition_enabled = False  # 设为 True 以启用颜色预测\nroi = 385                             # 感兴趣区域（计数线）的位置\ndeviation = 1                         # 计数区域的容差常数\n\n# 执行累计计数 (沿 X 轴)\nobject_counting_api.cumulative_object_counting_x_axis(\n    input_video, \n    detection_graph, \n    category_index, \n    is_color_recognition_enabled, \n    roi, \n    deviation\n)\n```\n\n### 3.2 实时计数模式 (Real-Time Counting Mode)\n适用于实时统计画面中特定物体的数量。\n\n**示例：统计画面中的“自行车”数量**\n```python\nimport object_counting_api\n\n# 配置参数\nis_color_recognition_enabled = False\ntargeted_objects = \"bicycle\"  # 指定目标对象类别\n\n# 执行特定目标计数\nobject_counting_api.targeted_object_counting(\n    input_video, \n    detection_graph, \n    category_index, \n    is_color_recognition_enabled, \n    targeted_objects\n)\n```\n\n**示例：统计画面中所有物体**\n```python\nimport object_counting_api\n\nis_color_recognition_enabled = False\n\n# 执行全量计数\nobject_counting_api.object_counting(\n    input_video, \n    detection_graph, \n    category_index, \n    is_color_recognition_enabled\n)\n```\n\n### 3.3 物体跟踪模式 (Object Tracking Mode)\n用于检测并跟踪视频中的物体轨迹。直接运行官方提供的示例脚本即可：\n\n```bash\npython object_tracking.py\n```\n\n### 3.4 调整检测阈值\n默认的最小检测阈值为 0.5 (50%)。如需调整灵敏度，请修改 `utils\u002Fvisualization_utils.py` 文件中的第 443 行左右：\n\n```python\n# 在 utils\u002Fvisualization_utils.py 中\nmin_score_thresh = 0.5  # 修改此值 (0.0 - 1.0)\n```\n\n---\n**提示**：更多高级用法（如自定义模型训练、Mask R-CNN 分割计数）请参考项目仓库中的 `smurf_counter_training` 或 `mask_rcnn_counting_api` 文件夹下的示例项目。","某大型连锁超市希望利用现有监控摄像头，自动统计高峰期各收银台前的排队人数，以动态调整开放窗口数量并优化顾客体验。\n\n### 没有 tensorflow_object_counting_api 时\n- **开发门槛极高**：团队需从零搭建基于 TensorFlow 和 Keras 的复杂架构，手动整合目标检测、追踪与计数逻辑，耗时数周仅能完成原型。\n- **重复计数误差大**：缺乏成熟的追踪模块，同一顾客在画面中移动时容易被反复识别，导致统计数据虚高，无法反映真实排队长度。\n- **定制成本昂贵**：若想统计特定商品（如促销堆头的饮料箱）而非仅统计人头，需自行收集数据并重新训练模型，技术难度让项目被迫搁置。\n- **实时性难以保障**：自研代码未经深度优化，在普通服务器上进行实时视频流分析时帧率低下，无法满足秒级决策需求。\n\n### 使用 tensorflow_object_counting_api 后\n- **快速部署落地**：直接调用其内置的累积计数和实时计数模式，几天内即可将监控视频接入系统，大幅缩短从概念到验证的周期。\n- **精准去重统计**：利用其集成的先进对象追踪算法，有效锁定每个移动个体，确保顾客进出只被计数一次，数据准确率显著提升。\n- **灵活定制场景**：借助其自定义训练功能（如官方演示的意面计数案例），团队轻松微调模型以识别特定货物或特殊着装人员，适应多变业务。\n- **高效实时运行**：框架经过专门优化，能在常规硬件上流畅处理多路视频流，即时输出人流热力图供管理层决策。\n\ntensorflow_object_counting_api 通过将复杂的视觉算法封装为易用的 API，让非顶尖 AI 团队也能低成本构建高精度、可定制的实时物体计数系统。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fahmetozlu_tensorflow_object_counting_api_21a0dc40.gif","ahmetozlu","Ozlu","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fahmetozlu_66e2f020.jpg","If you are interested to hire me remotely for your Computer Vision based AI projects, please send me your requirement list and the deadlines via an e-mail!",null,"Brussels","ahmetozlu93@gmail.com","https:\u002F\u002Fahmetozlu.medium.com","https:\u002F\u002Fgithub.com\u002Fahmetozlu",[85],{"name":86,"color":87,"percentage":88},"Python","#3572A5",100,1332,544,"2026-04-03T23:38:45","MIT",5,"未说明","未说明 (基于 TensorFlow 和 Keras，通常支持 CPU 或 NVIDIA GPU，但 README 未指定具体型号、显存或 CUDA 版本要求)",{"notes":97,"python":94,"dependencies":98},"该工具基于 TensorFlow 和 Keras 构建。README 中未明确列出具体的操作系统、Python 版本、内存大小或 GPU 硬件要求。用户需自行安装 TensorFlow 环境。支持使用 Google Brain Team 训练的预训练模型或使用自定义\u002F微调的模型。功能包括实时计数、累计计数、目标跟踪、颜色识别及速度预测。部分高级功能（如 Mask R-CNN）有独立的子模块链接。",[99,100,101,102,103],"TensorFlow","Keras","OpenCV (隐含，用于视频处理)","NumPy (隐含)","Matplotlib (隐含，用于可视化)",[13,53,54,51,14],[106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125],"object-detection","object-counting","object-counting-api","object-detection-api","tensorflow","tensorflow-api","object-detection-label","object-detection-pipelines","opencv","computer-vision","machine-learning","image-processing","deep-learning","deep-neural-networks","data-science","tensorflow-object-detection-api","vehicle-counting","pedestrian-counting","shelf-management","shelf-navigation","2026-03-27T02:49:30.150509","2026-04-06T08:10:25.539949",[129,134,139,144,149,154,159],{"id":130,"question_zh":131,"answer_zh":132,"source_url":133},15423,"运行脚本时出现 'RuntimeError: Attempted to use a closed Session' 错误怎么办？","这是一个 Python 缩进问题。代码中使用了 `with tf.Session() as sess:` 上下文管理器，它会在作用域结束时自动关闭 session。你需要确保所有依赖该 session 的代码（如推理调用）都正确缩进在 `with` 语句块内部。请检查并调整缩进，使相关代码位于 `with tf.Session(graph=detection_graph) as sess:` 之下。","https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Ftensorflow_object_counting_api\u002Fissues\u002F59",{"id":135,"question_zh":136,"answer_zh":137,"source_url":138},15424,"车辆穿过 ROI 线时未被检测到或计数不准确怎么办？","这通常不是固定的 Bug，而是算法参数需要调整。你可以尝试修改计数模块中的逻辑来改善检测效果。具体来说，可以查看并调整 `utils\u002Fobject_counting_module\u002Fobject_counter_x_axis.py` 文件中的相关行（例如第 11 行附近），或者调整用于定义检测区域的 \"bottom\" 变量（ymin, ymax）以匹配你的视频场景。","https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Ftensorflow_object_counting_api\u002Fissues\u002F5",{"id":140,"question_zh":141,"answer_zh":142,"source_url":143},15425,"项目缺少 requirements.txt 文件且安装指南不完善，如何解决依赖问题？","维护者已更新仓库，现在包含了 `requirements.txt` 文件和详细的安装指南。请注意，目前该 API 尚未支持 TensorFlow 2.x 版本，建议使用兼容的 TensorFlow 1.x 版本以避免兼容性问题。","https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Ftensorflow_object_counting_api\u002Fissues\u002F93",{"id":145,"question_zh":146,"answer_zh":147,"source_url":148},15426,"运行 single_image_object_counting.py 时出现属性错误 'module has no attribute visualize_boxes_and_labels_on_single_image_array'？","这通常是由于输入处理部分的代码逻辑或行号引用有误。检查代码中读取图像的部分，确保正确使用 `cv2.imread(input_video)` 加载图像帧（通常在第 461 行左右），并确认调用的可视化函数名称与当前版本的 `utils.visualization_utils` 模块一致。如果不确定，可参考社区提供的修正文件或最新代码库。","https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Ftensorflow_object_counting_api\u002Fissues\u002F22",{"id":150,"question_zh":151,"answer_zh":152,"source_url":153},15427,"结果视频中出现了标记为 'smurf' 的蓝色边界框，这是什么意思？","这通常是因为模型将某些物体错误分类为了 'smurf' 类别，或者是演示代码中的默认标签映射问题。该问题在后续的版本更新中已被解决。请尝试拉取最新的代码并重新运行 `vehicle_counting.py` 脚本，检查结果是否恢复正常。","https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Ftensorflow_object_counting_api\u002Fissues\u002F44",{"id":155,"question_zh":156,"answer_zh":157,"source_url":158},15428,"如何使用自己的数据集训练模型以检测特定对象（如特定品牌的车辆或商品）？","你需要基于 TensorFlow Object Detection API 流程自定义训练模型。步骤包括：1. 准备包含特定标签（如车型、商品名）的自定义数据集；2. 训练模型并生成冻结的推理图（frozen inference graph）；3. 在计数 API 中加载这个自定义的图和对应的标签映射文件（category index）。目前官方正在规划提供包含完整训练代码和文档的示例项目，你也可以参考相关的 Issue 讨论获取贡献者的建议。","https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Ftensorflow_object_counting_api\u002Fissues\u002F18",{"id":160,"question_zh":161,"answer_zh":162,"source_url":163},15429,"运行单张图片计数脚本时报错，是否有修复后的文件可用？","早期版本中存在一些代码缺陷导致单张图片计数脚本报错。社区用户曾提供过修正后的 `object_counting_api.py` 文件链接供临时使用。建议优先检查主仓库是否已合并了相关的修复补丁，或者直接下载最新的源代码覆盖本地文件，注意修复可能涉及具体的缩进调整。","https:\u002F\u002Fgithub.com\u002Fahmetozlu\u002Ftensorflow_object_counting_api\u002Fissues\u002F7",[165],{"id":166,"version":167,"summary_zh":168,"released_at":169},90089,"mask_rcnn_barilla-spaghetti_v1.h5","请查收附件中的文件（mask_rcnn_barilla-spaghetti_0040.h5）！","2020-03-29T14:15:04"]