-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initialize detective module structure and add core functionality
- Loading branch information
qijun han
committed
Dec 9, 2024
1 parent
323e881
commit c900066
Showing
39 changed files
with
209 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Detective | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
Metadata-Version: 2.1 | ||
Name: detective_pi | ||
Version: 0.1.0 | ||
Summary: A versatile tool for daily use | ||
Home-page: https://github.com/sergiudm/detective | ||
Author: Sergiu Han | ||
Author-email: sergiudm@outlook.com | ||
Classifier: Programming Language :: Python :: 3 | ||
Classifier: License :: OSI Approved :: MIT License | ||
Classifier: Operating System :: OS Independent | ||
Requires-Python: >=3.10 | ||
Description-Content-Type: text/markdown | ||
Requires-Dist: opencv-python | ||
Requires-Dist: opencv-python-headless | ||
Requires-Dist: mediapipe | ||
|
||
detective:一款更适合中国宝宝的室友内卷监测工具 | ||
================================================== | ||
|
||
## 介绍 | ||
|
||
detective是一款更适合中国宝宝的室友内卷监测工具,它可以帮助你监测室友的内卷行为,让你的寝室生活更加和谐。 | ||
> TODO:demo | ||
|
||
## 环境要求 | ||
| 环境 | 版本 | | ||
| ------ | ---------------------------- | | ||
| OS | Ubuntu22.04, Raspberry Pi OS, Window11, Debian 12| | ||
| Python | 3.10 | | ||
|
||
## 硬件清单 | ||
- Raspberry Pi 4B * 2 | ||
- 摄像头 * 2 | ||
- 蜂鸣器 | ||
- LED灯 | ||
- 面包板 | ||
|
||
## 安装依赖 | ||
克隆仓库 | ||
```bash | ||
git clone https://github.com/sergiudm/detective.git | ||
cd detective | ||
``` | ||
### 一键安装 | ||
```bash | ||
./deploy.sh | ||
``` | ||
### 手动安装 | ||
创建虚拟环境 | ||
```bash | ||
conda create -n <your_env_name> python=3.10 | ||
conda activate <your_env_name> | ||
pip install -r requirements.txt | ||
``` | ||
|
||
## 使用说明 | ||
开始前,你需要配置`config.json`文件, | ||
以下是一个示例: | ||
```json | ||
{ | ||
"default_detect_mode": "others", | ||
"use_camera": true, | ||
"LED_pin": 18, # LED灯的引脚 | ||
"use_visualization": false, # 是否使用可视化 | ||
"server_email": "youremail@example.com", | ||
"server_email_password": "your email password",# 请使用授权码 | ||
"target_email": [ | ||
"email1", | ||
"email2" | ||
], | ||
"smtp_server":"your smtp server", | ||
"smtp_port": 587, | ||
"video_path": "assets/videos/sit.mp4", # use_camera为false时,使用该视频 | ||
"image_path": "resources", # 邮件中的图片 | ||
"send_delay": 13, | ||
"effective_detection_duration": 2, | ||
"max_num_hands": 2, | ||
"min_detection_confidence": 0.65, | ||
"min_tracking_confidence": 0.65 | ||
} | ||
``` | ||
>[!CAUTION] | ||
实际使用时,请删除`config.json`中的所有注释! | ||
|
||
Linux: | ||
```bash | ||
cd detective | ||
sudo chmod +x run.sh | ||
./run.sh | ||
``` | ||
Windows: | ||
```bash | ||
cd detective | ||
python main.py | ||
``` | ||
|
||
## 功能 | ||
- 检测是否有室友在内卷 | ||
- 如果有,会自动响起警报,并且发微信通知你 | ||
- 检测你是不是卷过头了 | ||
- 如果连续工作超过2小时(可在`config.json`中配置),会自动响起警报,并提醒你休息一下 | ||
- to do list | ||
- 检测 学习 与 玩游戏 | ||
- 肩部、髋部、膝盖 夹角; 手部 位置 | ||
- 报警:蜂鸣器(可换为便宜的喇叭)(直到结束学习才消失)、led、微信发消息 | ||
- 开关门检测 | ||
- 开关门 检测完成后: 人在寝室,才监控 | ||
- 不良坐姿的检测 | ||
- 魔术 | ||
|
||
## 如何贡献 | ||
本仓库仅使用了[mediapipe](https://github.com/google-ai-edge/mediapipe)中的人体姿态检测和手部检测功能,如果你有更多想法,欢迎: | ||
|
||
- 提交PR | ||
- [插件指南]() | ||
- 提交Issue | ||
- 传播给更多的室友 | ||
|
||
## Acknowledgement | ||
[mediapipe](https://github.com/google-ai-edge/mediapipe) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
README.md | ||
setup.py | ||
detective/__init__.py | ||
detective/main.py | ||
detective/communication/__init__.py | ||
detective/communication/client.py | ||
detective/communication/mailbot.py | ||
detective/communication/server.py | ||
detective/modules/__init__.py | ||
detective/modules/common.py | ||
detective/modules/detect_master.py | ||
detective/modules/detect_others.py | ||
detective/modules/device.py | ||
detective/modules/gesture.py | ||
detective/modules/utils.py | ||
detective_pi.egg-info/PKG-INFO | ||
detective_pi.egg-info/SOURCES.txt | ||
detective_pi.egg-info/dependency_links.txt | ||
detective_pi.egg-info/requires.txt | ||
detective_pi.egg-info/top_level.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
opencv-python | ||
opencv-python-headless | ||
mediapipe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
detective |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from setuptools import setup, find_packages | ||
|
||
setup( | ||
name="detective_pi", | ||
version="0.1.0", | ||
author="Sergiu Han", | ||
author_email="sergiudm@outlook.com", | ||
description="A versatile tool for daily use", | ||
long_description=open("README.md").read(), | ||
long_description_content_type="text/markdown", | ||
url="https://github.com/sergiudm/detective", | ||
packages=find_packages(include=["detective", "detective.*"]), | ||
install_requires=[ | ||
"opencv-python", | ||
"opencv-python-headless", | ||
"mediapipe", | ||
], | ||
classifiers=[ | ||
"Programming Language :: Python :: 3", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
], | ||
python_requires=">=3.10", | ||
entry_points={ | ||
}, | ||
) |