Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
software/cricket.pt
software/config.env

# APNs密钥文件(敏感信息)
software/apns_key.p8
software/*.p8
*.p8

# APNS证书文件(如果使用certificate-based认证)
software/*.p12
software/*.pem
*.p12
*.pem

# 日志文件
software/logs/
software/*.log

# Python缓存
software/__pycache__/
software/*.pyc
software/*.pyo
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
# Security Camera Team 3


MQTT Message Format:

objects = [{'class': classes[i], 'confidence': confidences[i]} for i in range(len(classes))]

message = {
"objects": objects,
"timestamp": datetime.now().isoformat()
}
44 changes: 44 additions & 0 deletions software/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Python cache
__pycache__/
*.py[cod]
*$py.class
*.so
.Python

# Virtual environments
venv/
env/
ENV/

# IDE
.vscode/
.idea/
*.swp
*.swo
.ropeproject/

# OS files
.DS_Store
Thumbs.db

# Git
.git/
.gitignore

# Testing files
testing/

# Config files (should be mounted as volume)
# config.env

# Documentation
README.md
*.md

# Model files (if not needed in image)
# *.pt

# Docker
.dockerignore
Dockerfile
docker-compose.yml
14 changes: 14 additions & 0 deletions software/.env.docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Docker Compose Environment Configuration
# This file allows you to customize the config and model paths

# Path to your config.env file (contains MQTT and RTMP settings)
CONFIG_PATH=./config.env

# Path to your YOLO model file
MODEL_PATH=./50epoch.pt

# Example: Use a different model
# MODEL_PATH=./my-custom-model.pt

# Example: Use a different config
# CONFIG_PATH=./config.production.env
9 changes: 9 additions & 0 deletions software/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# MQTT Broker Configuration
MQTT_BROKER=your_mqtt_broker_address
MQTT_PORT=1883
MQTT_USERNAME=your_username
MQTT_PASSWORD=your_password
MQTT_TOPIC=camera/detections

# RTMP Stream Configuration
RTMP_STREAM_URL=rtmps://your-stream-url
Binary file added software/50epoch.pt
Binary file not shown.
43 changes: 43 additions & 0 deletions software/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Use Python 3.11 slim image as base
FROM python:3.11-slim

# Set working directory
WORKDIR /app

# Install system dependencies required for OpenCV and video processing
RUN apt-get update && apt-get install -y \
libgl1 \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender1 \
libgomp1 \
libgthread-2.0-0 \
libavcodec-dev \
libavformat-dev \
libswscale-dev \
libv4l-dev \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*

# Copy requirements file
COPY requirements.txt .

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy application code
COPY server.py .
COPY mqtt_client.py .
COPY apns_manager.py .

# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV MODEL_PATH=/app/models/model.pt
ENV CONFIG_PATH=/app/config.env

# Create directories for mounted volumes and logs
RUN mkdir -p /app/models /app/logs

# Run the application in headless mode with detection every 60 frames
CMD ["python", "server.py", "--headless", "--detection-interval", "60"]
Loading