diff --git a/Dockerfile b/Dockerfile index f08c1d2ed..80bca9645 100644 --- a/Dockerfile +++ b/Dockerfile @@ -83,6 +83,8 @@ RUN (apt-get autoremove -y; \ ENV PYTHONPATH "$PYTHONPATH:/usr/local/lib/python3.5/dist-packages/tensorflow/models/research:/usr/local/lib/python3.5/dist-packages/tensorflow/models/research/slim" RUN cd /usr/local/lib/python3.5/dist-packages/tensorflow/models/research && protoc object_detection/protos/*.proto --python_out=. +WORKDIR /opt/frigate/ +ADD frigate frigate/ COPY detect_objects.py . CMD ["python3", "-u", "detect_objects.py"] \ No newline at end of file diff --git a/README.md b/README.md index b85a34274..9088c9be1 100644 --- a/README.md +++ b/README.md @@ -29,12 +29,31 @@ docker run --rm \ -e RTSP_URL='' \ -e REGIONS=',,,,,:,,,,,' \ -e MQTT_HOST='your.mqtthost.com' \ --e MQTT_MOTION_TOPIC='cameras/1/motion' \ --e MQTT_OBJECT_TOPIC='cameras/1/objects' \ --e MQTT_OBJECT_CLASSES='person,car,truck' \ +-e MQTT_TOPIC_PREFIX='cameras/1' \ +-e DEBUG='0' \ realtime-od:latest ``` +Example compose: +``` + frigate: + container_name: frigate + restart: unless-stopped + image: realtime-od:latest + volumes: + - :/frozen_inference_graph.pb:ro + - :/label_map.pbtext:ro + - :/config + ports: + - "127.0.0.1:5000:5000" + environment: + RTSP_URL: "" + REGIONS: ",,,,,:,,,,," + MQTT_HOST: "your.mqtthost.com" + MQTT_TOPIC_PREFIX: "cameras/1" + DEBUG: "0" +``` + Access the mjpeg stream at http://localhost:5000 ## Tips diff --git a/detect_objects.py b/detect_objects.py index d774b0ae5..0171e767d 100644 --- a/detect_objects.py +++ b/detect_objects.py @@ -25,7 +25,6 @@ RTSP_URL = os.getenv('RTSP_URL') MQTT_HOST = os.getenv('MQTT_HOST') MQTT_TOPIC_PREFIX = os.getenv('MQTT_TOPIC_PREFIX') -MQTT_OBJECT_CLASSES = os.getenv('MQTT_OBJECT_CLASSES') # REGIONS = "350,0,300,50:400,350,250,50:400,750,250,50" # REGIONS = "400,350,250,50" @@ -150,8 +149,7 @@ def main(): client.loop_start() # start a thread to publish object scores (currently only person) - mqtt_publisher = MqttObjectPublisher(client, MQTT_TOPIC_PREFIX, objects_parsed, - MQTT_OBJECT_CLASSES.split(','), DETECTED_OBJECTS) + mqtt_publisher = MqttObjectPublisher(client, MQTT_TOPIC_PREFIX, objects_parsed, DETECTED_OBJECTS) mqtt_publisher.start() # start thread to publish motion status diff --git a/frigate/mqtt.py b/frigate/mqtt.py index 2dfecd4ca..d72c7deb8 100644 --- a/frigate/mqtt.py +++ b/frigate/mqtt.py @@ -25,12 +25,11 @@ class MqttMotionPublisher(threading.Thread): self.client.publish(self.topic_prefix+'/motion', motion_status, retain=False) class MqttObjectPublisher(threading.Thread): - def __init__(self, client, topic_prefix, objects_parsed, object_classes, detected_objects): + def __init__(self, client, topic_prefix, objects_parsed, detected_objects): threading.Thread.__init__(self) self.client = client self.topic_prefix = topic_prefix self.objects_parsed = objects_parsed - self.object_classes = object_classes self._detected_objects = detected_objects def run(self):