brandonjoffe / home_surveillance Goto Github PK
View Code? Open in Web Editor NEWHome surveillance system with facial recognition
Home surveillance system with facial recognition
Hello,
I successfully run the docker container and I have access the Home Dashboard. I am wondering if it is possible to use the webcam as an IP camera ?
I created a stream and diffused it over HTTP through VLC on my local host (the same machine running the docker container). This is my configuration:
-IP adress: 192.168.0.13
-Port: 8081
-Path: stream.wmv
-Transcoding option: WMV+WMA.
=> My integrated webcam is switched on and the stream is diffused
Then, when I put 192.168.0.13:8081/stream.wmv in the URL camera URL and then click on Add Camera, then nothing happens. Any idea ?
Hi,
I am curious to know more about why certain ports are opened between the host and docker container as I am having some issues. I understand the port 5000 as this is the port to reach the web gui of the application so it needs to be accessible between the host and the container, but the other two ports I am not sure of 9000 & 8000.
When I try to issue the docker run command I get the following message:
Bind for 0.0.0.0:9000 failed: port is already allocated.
My host currently runs a Nginx web server with php-fpm already running on port 9000 and assume this explains the above message however I am not sure how to fix it. I attempted to use 9001 instead of 9000 in the docker run command and it seems to work however I get socket error messages when I attempt to test camera and assume that this might be related to the fact I used 9001 instead.
Can you explain what listens on these ports and how I should go about changing the port for the docker container. Or maybe I can just use the existing php-fpm server that is on the host from within the docker container? Thanks I am new to docker and still making my way through the docs so bare with me a bit.
Thanks
Hi BrandonJoffe,
the 'labels.csv' and 'reps.csv' files are empty after i used ./batch-represent/main.lua -outDir /img/genrate-embed -data /img/align_images it shows this message:
[C]: in function 'assert'
/root/openface/batch-represent/dataset.lua:193: in function '__init'
/root/torch/install/share/lua/5.1/torch/init.lua:91: in function </root/torch/install/share/lua/5.1/torch/init.lua:87>
[C]: in function 'dataLoader'
/root/openface/batch-represent/batch-represent.lua:19: in function 'batchRepresent'
./batch-represent/main.lua:42: in main chunk
[C]: in function 'dofile'
/root/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
[C]: at 0x00406670
as a result i cant generate a 'classifier.pkl' file i am using docker on windows 10
Hi;
FYI, these warnings are shown on the screen right after running WebApp.py
:
WebApp.py:20: ExtDeprecationWarning: Importing flask.ext.uploads is deprecated, use flask_uploads instead.
from flask.ext.uploads import UploadSet, configure_uploads, IMAGES
/usr/local/lib/python2.7/dist-packages/sklearn/lda.py:4: DeprecationWarning: lda.LDA has been moved to discriminant_analysis.LinearDiscriminantAnalysis in 0.17 and will be removed in 0.19
"in 0.17 and will be removed in 0.19", DeprecationWarning)
WebApp.py:22: ExtDeprecationWarning: Importing flask.ext.socketio is deprecated, use flask_socketio instead.
Cheers,
Vahid
i am wondering how this project go is someone still work on it beside Brandon. Or there is fork version of it .. some where that more active ? i see good potential on it .. anyone know is there any project to this and active?
Hello,
I started digging the code. Thank you for sharing is :-)
I almost started running it on Pycharm. I noticed that there are some missing methods used in ImageUtils, such as: detect_cascade(), detect_cascadeface(), rgb_pre_processing(), ...
Although these methods are not used elsewhere, I think only pre_processing() is used in FaceRecognizer, do we really still need them ? may be I am missing something.
Second question regarding the version of OpenCV used to capture Video and generating Fames. Which version have you guys used ?
Hi Brandon;
how many samples should we prepared for one person when we train a xxx.pkl .
and does the picture need to be written in a fixed Angle?
up? down? right?and left???
I really appreciate your help.
Thanks,
Lynn
`=== training-images/unknown/8-13.jpg ===
error :( https://ibb.co/caBBZT
if you want to use an iphone as your ip camera, download the free app called "liveReporter". add the camera to your project (don't check the fps tweak box) and voila. you may have to do port forwarding if on your local wifi.
Hello!
Thank you for your share, i am successful run it, but i have a question about the "path". When I run the docker, i try to use the command ' python system/WebApp.py ' and the results is ' TemplateNotFound: login.html' . I guess it is problem of path, i found ' join_path' in file environments.py and change it , but it seems didn't work , where should i change and how ? Thank you every much.
Hi;
Retrain Database is not working anymore after the recent updates. I checked out to commit commit bfd9c39 which is just before the recent updates and it is working fine.
Vahid
Hi,
I would like to try and build your system but wanted to check what do you recommend as an IP Camera?
Thanks!
Hell please help me install this on a mac. So far I tried following this
Clone Repo
git clone https://github.com/BrandonJoffe/home_surveillance.git
Pull Docker Image
docker pull bjoffe/openface_flask_v2
Run Docker image, make sure you mount your User (for MAC) or home (for Ubuntu) directory as a volume so you can access your local files
docker run -v /Users/:/host -p 9000:9000 -p 8000:8000 -p 5000:5000 -t -i bjoffe/openface_flask_v2 /bin/bash
Navigate to the home_surveillance project inside the volume within your Docker container
Move into the system directory
cd system
Run WebApp.py
python WebApp.py
Visit localhost:5000
Login Username: admin Password admin
Hi;
In the past few hours that I'm playing with the application, it has thrown a segmentation fault a few times:
(Thread-645) 127.0.0.1 - - [25/Jan/2017 14:34:05] "GET /socket.io/?EIO=3&transport=polling&t=1485372845035-589&sid=498f51d909d04a05ab27cf8a801c57b1 HTTP/1.1" 200 -
Segmentation fault (core dumped)
Vahid
here are the errors I am seeing on the console...the ip addresses I do not recognize, I assume one is the ip address of the docker container instance.
Exception happened during processing of request from ('192.168.0.70', 45884)
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 593, in process_request_thread
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.7/SocketServer.py", line 651, in __init__
self.finish()
File "/usr/lib/python2.7/SocketServer.py", line 710, in finish
self.wfile.close()
File "/usr/lib/python2.7/socket.py", line 279, in close
self.flush()
File "/usr/lib/python2.7/socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
----------------------------------------
Exception in thread Thread-132:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
File "/usr/local/lib/python2.7/dist-packages/python_socketio-1.4.2-py2.7.egg/socketio/server.py", line 458, in _handle_eio_message
self._handle_event(sid, pkt.namespace, pkt.id, pkt.data)
File "/usr/local/lib/python2.7/dist-packages/python_socketio-1.4.2-py2.7.egg/socketio/server.py", line 400, in _handle_event
r = self._trigger_event(data[0], namespace, sid, *data[1:])
File "/usr/local/lib/python2.7/dist-packages/python_socketio-1.4.2-py2.7.egg/socketio/server.py", line 426, in _trigger_event
return self.handlers[namespace][event](*args)
File "/usr/local/lib/python2.7/dist-packages/Flask_SocketIO-2.6-py2.7.egg/flask_socketio/__init__.py", line 196, in _handler
ret = handler(*args)
File "WebApp.py", line 340, in panic
HomeSurveillance.trigger_alarm()
File "/host/docker/home_surveillance/system/SurveillanceSystem.py", line 873, in trigger_alarm
r = requests.post('http://192.168.1.35:5000/trigger', data={"password": "admin"})
File "/usr/lib/python2.7/dist-packages/requests/api.py", line 88, in post
return request('post', url, data=data, **kwargs)
File "/usr/lib/python2.7/dist-packages/requests/api.py", line 44, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 455, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 558, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 378, in send
raise ConnectionError(e)
ConnectionError: HTTPConnectionPool(host='192.168.1.35', port=5000): Max retries exceeded with url: /trigger (Caused by <class 'socket.error'>: [Errno 110] Connection timed out)
hey @BrandonJoffe
i really love your project,
unfortunately i'm unable to use it.
i installed and run the docker, but whenever i tried to use the link on the sidebar (users, server, client settings etc..) nothing happens,
another issue while trying to play with the GUI interface i get
Exception happened during processing of request from ('10.10.10.2', 50357) Traceback (most recent call last): File "/usr/lib/python2.7/SocketServer.py", line 593, in process_request_thread self.finish_request(request, client_address) File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/lib/python2.7/SocketServer.py", line 651, in __init__ self.finish() File "/usr/lib/python2.7/SocketServer.py", line 710, in finish self.wfile.close() File "/usr/lib/python2.7/socket.py", line 279, in close self.flush() File "/usr/lib/python2.7/socket.py", line 303, in flush self._sock.sendall(view[write_offset:write_offset+buffer_size]) error: [Errno 32] Broken pipe
can you help?
thank you!
hello , I am the first time to know openface ,and i think your code is very uesful for me.
but i does not know how to made the code running . opencv2.4.11+ torch7 + ubuntu16.04 + dlib ? if anything else? i can running the demo 123 downloaded from openface website .
Is anyone here can provide this code Operation guide。
@BrandonJoffe @vgunning
thanks
emmmmm ..... sorry ,my english is very poor.
I'm trying to install in windows 10 but, i'm getting following error
`D:\home\system>python WebApp.py
Traceback (most recent call last):
File "WebApp.py", line 21, in
import camera
ModuleNotFoundError: No module named 'camera'
`
how to overcome it!
Thank you!
Hi;
I am trying to train the classifier for face detection. First, I have added a directory with my name under system/training-images
containing tens of photos of me. Then clicked the "Retrain Database" button. Based on what I saw in the log messages on the screen, it seemed it could detect my face in the photos in the process of training:
=== training-images/Vahid/2017-01-25-134630_3.jpg ===
+ Writing aligned file to disk.
Aligning images took 22.2132079601 seconds.
/home/vd/home_surveillance/system/../batch-represent
But at the end, it threw this error and won't actually detect me in the application:
Representation Generation (Classification Model) took 0.551834821701 seconds.
Loading embeddings.
[2017-01-25 13:27:48,157] ERROR in app: Exception on /retrain_classifier [POST]
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "WebApp.py", line 251, in retrain_classifier
retrained = HomeSurveillance.recogniser.trainClassifier()
File "/home/vd/home_surveillance/system/FaceRecogniser.py", line 178, in trainClassifier
self.train("generated-embeddings/","LinearSvm",-1)
File "/home/vd/home_surveillance/system/FaceRecogniser.py", line 205, in train
labels = pd.read_csv(fname, header=None).as_matrix()[:, 1]
File "/usr/local/lib/python2.7/dist-packages/pandas/io/parsers.py", line 646, in parser_f
return _read(filepath_or_buffer, kwds)
File "/usr/local/lib/python2.7/dist-packages/pandas/io/parsers.py", line 389, in _read
parser = TextFileReader(filepath_or_buffer, **kwds)
File "/usr/local/lib/python2.7/dist-packages/pandas/io/parsers.py", line 730, in __init__
self._make_engine(self.engine)
File "/usr/local/lib/python2.7/dist-packages/pandas/io/parsers.py", line 923, in _make_engine
self._engine = CParserWrapper(self.f, **self.options)
File "/usr/local/lib/python2.7/dist-packages/pandas/io/parsers.py", line 1390, in __init__
self._reader = _parser.TextReader(src, **kwds)
File "pandas/parser.pyx", line 538, in pandas.parser.TextReader.__cinit__ (pandas/parser.c:6171)
EmptyDataError: No columns to parse from file
Besides that, I have deleted all the predefined persons and their photos from the directories; But still it recognizes me as other ones. It seems their data is still in the database.
I really appreciate your help.
Thanks,
Vahid
Hi any chance you can share the Dockerfile used to create docker image? I am interested in trying to update everything to use Python 3 and newer versions of opencv and dlib if possible.
Is it possible to install the whole system including the alarms module on raspberry pi?
hi, i try to run this with the latest python 3.6 from anaconda i can't seem to get it to work ..
i keep get this error, i cant seem to find a fix to it.
XXXXXXXX@AI-DL:~/home_surveillance/system$ python WebApp.py
Traceback (most recent call last):
File "WebApp.py", line 20, in
from flask.ext.uploads import UploadSet, configure_uploads, IMAGES
ModuleNotFoundError: No module named 'flask.ext'
Hi;
I am streaming on Raspberry Pi 3 using GStreamer. This is my pipeline:
raspivid -t 999999 -h 240 -w 320 -fps 10 -hf -b 2000000 -o - | gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=1 pt=96 ! gdppay ! tcpserversink host=PI-IP-ADDRESS port=5000
and play the stream on my laptop using:
gst-launch-1.0 -v tcpclientsrc host=PI_IP_ADDRESS port=5000 ! gdpdepay ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false
I want to add the camera to the home_surveillance Dashboard. Do you have any idea what URL should I use? I'd really appreciate it.
Thanks,
Vahid
Hi @BrandonJoffe
Thanks for sharing this project!
It seems that you have unfortunately
hard-coded the password for the mail account [email protected]
. Please change your password at the earliest.
Next time, please make sure to use environment variables instead of hardcoding passwords.
Thanks,
Abhinav
whats the name of the facial detection algorithm used???
I am getting following response with command "docker pull bjoffe/openface_flask_v2"
Error response from daemon: Get https://registry-1.docker.io/v2/bjoffe/openface_flask_v2/manifests/latest: unauthorized: incorrect username or password
Can you please provide me docker image
why am i getting this error?
Traceback (most recent call last):
File "WebApp.py", line 38, in <module>
HomeSurveillance = SurveillanceSystem.SurveillanceSystem()
File "/host/system/SurveillanceSystem.py", line 120, in __init__
self.recogniser = FaceRecogniser.FaceRecogniser()
File "/host/system/FaceRecogniser.py", line 90, in __init__
(self.le, self.clf) = cPickle.load(f) # Loads labels and classifier SVM or GMM
ImportError: No module named copy_reg
Hello brando
thanks for such a wonderful project.
I pulled the image from the hub of dockedocker pull bjoffe / openface_flask and I'm looking for the home_surveillance folder, but can not find.
also clone the image from github, but does not have the dockerfile repositositorio file.
I get your bearings I'm doing wrong
first of all, Thanks,
saludes from Colombia
excuse my English use google translator
docker pull bjoffe/openface_flask_v2
Got permission denied while trying to connect to the Docker daemon
When I try to run WebApp.py using the command python WebApp.py
it gives me a ImportError.
Traceback (most recent call last):
File "webapp.py", line 19, in <module>
from flask import Flask, render_template, Response, redirect, url_for, request, jsonify, send_file, session, g
ImportError: No module named flask
I am installing this using the Docker Instructions.
if your labels and reps.csv file are empty (because the retrain process crashed before, leaving them empty) the whole retrain will not work. i'm working at adding a few lines of code to prevent that.
Hi;
I was wondering if there is an easy way to get the input stream from a video file, instead of a live camera.
Thanks,
Vahid
Hello,
I want to add the webcam of my computer as a camera. I have streamed the output to a url and copied the address in the specified field. However, the camera is not added eventhough "Adding Camera" is shown. Do you have any idea what is the problem or what should I do?
Thanks!
Hi;
I stream using MJPG-Streamer at 15FPS and 320x240 on one camera. The network connection is pretty well and CPU and memory usage are around %50. But the camera FPS in the Dashboard is usually around 1 for Face Recognition. The maximum I could achieve was around 4. For Motion Detection, I can get FPS around 25. I have tested it on two machines with 8GB and 4GB of RAM and the situation is similar. Is that normal? Is there any way I can have a better FPS for Face Recognition? I don't need the Alert System and other parts rather than the basic part of adding a couple of cameras and recognizing faces.
Thanks for your time. :-)
Cheers,
Vahid
How can i configure the project to use GPU?
IP Camera URL of 192.168.1.10
I've written. The camera is not added when I click the "Add camera" button.
I see "adding camera" for a long time.
Vlc player de rtsp: //192.168.1.10 the camera is running when I type.
when i refresh firefox browser; Terminal screen:
"Exception happened from processing of request from ('172.17.0.1', 47626)
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 593, in process_request_thread
self.finish_request (request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
self.RequestHandlerClass (request, client_address, self)
File "/usr/lib/python2.7/SocketServer.py", line 651, in init
self.finish ()
File "/usr/lib/python2.7/SocketServer.py", line 710, in finish
self.wfile.clos A ()
File "/usr/lib/python2.7/socket.py", line 279, in close
self.flush ()
File "/usr/lib/python2.7/socket.py", line 303, in flush
self._sock.sendall (view [write_offset: write_offset BUFFER_SIZE +])
error: [Errno 32] Broken pipe
"
Note: I am using google translate. There may be a translation error.
Hi;
The application was running fine but suddenly stopped with the following error:
OpenCV Error: Assertion failed (ssize.area() > 0) in resize, file /root/ocv-tmp/opencv-2.4.11/modules/imgproc/src/imgwarp.cpp, line 1968
(Thread-894) Error on request:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/werkzeug/serving.py", line 180, in run_wsgi
execute(self.server.app)
File "/usr/local/lib/python2.7/dist-packages/werkzeug/serving.py", line 170, in execute
for data in application_iter:
File "/usr/local/lib/python2.7/dist-packages/werkzeug/wsgi.py", line 693, in __next__
return self._next()
File "/usr/local/lib/python2.7/dist-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
for item in iterable:
File "/host/home_surveillance/system/WebApp.py", line 106, in gen
frame = camera.read_processed() # read_jpg() # read_processed()
File "/host/home_surveillance/system/Camera.py", line 147, in read_processed
frame = ImageUtils.resize_mjpeg(frame)
File "/host/home_surveillance/system/ImageUtils.py", line 92, in resize_mjpeg
frame = cv2.resize(frame, dim, interpolation = cv2.INTER_AREA)
error: /root/ocv-tmp/opencv-2.4.11/modules/imgproc/src/imgwarp.cpp:1968: error: (-215) ssize.area() > 0 in function resize
*** Error in `python': double free or corruption (out): 0x00007f8ef4792910 ***
Aborted (core dumped)
Any idea?
Thanks,
Vahid
Hi;
I was wondering if the alarm system is fully implemented and operable. Has anyone used it so far? @BrandonJoffe @mathieuduperre @gauravkaila
Thanks,
Vahid
Good morning,
I guess I will be that guy this I really new... I'm trying to launch and move the step 4.
When I execute
docker run -v /Users/:/host -p 9000:9000 -p 8000:8000 -p 5000:5000 -t -i bjoffe/openface_flask_v2 /bin/bash
It says that I would need to mount my home directory but I don't really grasp the concept in how and which folder to mount.
I'm on Ubuntu, and I cloned the git in my /homerepo folder.
Can someone guide me please.
Thanks!
Hi,
Project looks great, however I didn't understand the setup process.
What are hardware requirements? Raspberry pi and a computer running Ubuntu with docker?
Thanks!
I downloaded the code and able to run WebApp.py I also got to the home dashboard on Safari. But it does not recognize my mac camera? Can you advise next step?
Hi, Joffe!
I'm trying to add 8 cameras, but the seventh video can not show in the browser, the sixth camera show "FPS:Loading..." always. And the HTML display the error "loader.js -> resource://devtools/shared/async-utils.js:55". My system is ubuntu17.04 and firefox57, i can't understand what's happened. Thank you for your help!
Hi Brandon,
First of all, really good work here!
I am trying to add my own IP camera to your dashboard but not being able to do so. I have your dashboard up and running as you see here,
The CPU load is 100% and the "Add Camera" button is running for over 30 mins. Do you have any suggestion by which I can add the camera? Am I doing something wrong here?
Best,
Gaurav
hi,
i'm having problems cleaning the old learning table and injecting my own pretty face.
i've deleted what was in aligned-images and training-images (i left the unkown directory). I added one with my name and a few pics of me. That does not seems to do the trick. My name appears in the drop down but i get an error in the log when it tries to ingest about "alignment".
so i'm guessing the teaching picture has to have some sort of format. woudl it be the case? I also notice that sometimes when you click retrain databse the whole system crash. I'm running your docker in ubuntu 16.
Can you provide some feedback (or point me toward some doc) about the input format for learning and the whole ingest/retrain process please?
thanks
Hello
I wonder how many months you spent developing this amazing project ?
Thanks
When i run docker i become this error.
docker run -v /Users/:/host -p 5000:5000 -t -i bjoffe/openface_flask_v2 /bin/bash
standard_init_linux.go:190: exec user process caused "exec format error"
What can i do?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.