Software

Breakdown

This page simply has a breakdwon of some of the code file names and what they all do. We understand that it can be a little intimidating to delve into large pools of unfamiliar code, so we hope this helps you get startd. We recommend sticking to the current code which uses a neural network, however, if you decide that the obsolete code could be refined to be more stable, that is an option as well. The obsolete code involves using the Haar cascade.

Current Code

record.py

POSSIBLY THE MOST IMPORTANT FILE

The existing header comments on this file are extremely helpful. However, here’s a walkthrough and some additional notes from this file. Keep in mind that this code was not written by us, so we can only provide a theoretical description of the code flow. Assuming the libraries used are intact, this description should be accurate

src/PublicEye Folder

To run, open the file within processing and press the “Run” button. Ensure that a video archive and visitor archive folders exist in a folder called “data/archive” and “data/visitor_movies” folder, respectively, and that the archive has at least 6 video clips. Uses four subfiles: DrawMovie.pde, Log.java, MovieManager.java, VisitorClip.java:

classify_image.py

As the name implies, this file is used to determine if an image contains an eye or not. It appears to mostly be taken directly from some TensorFlow library or another.

tf_files folder

This contains the files for a tensorflow model. The important thing to note here is that this contains:

Use:

Note: this folder is referenced in the file classify_image.py

Classify_image.py has been imported by record.py

Essentially, here’s the flow of code

Obsolete Code

src/eyeDetection Folder

This is very similar to EyeDetection.py in the root directory. This folder is also obsolete and only kept for documentation purposes. The two main files in this folder are haarcascade_eye2.xml and opencvtest.cpp.

EyeDetection.py

This is an obsolete file that was no longer used and just left for documentation purposes. Here’s a quick description of what it does:

src/arduino

This is an obsolete folder. All Arduino code is obsolete. The newest implementation has no use for an Arduino.

It has code to play some audio for the automation as the original implementation used an Arduino with the proximity sensor. This is really it. This can be ignored.

scripts folder

This folder contains a whole mess of files from different places. For example, retrain.py and show_image.py are from a codelabs repository called “TensorFlow for poets 2”, along with multiple other files in this folder. Meanwhile, openCV_video.py is unlabeled and, assuming the name is correct, intended for use with openCV and not tensorflow. As far as I can tell, none of the files from the codelabs repository were edited in any way, meaning they were probably used to get a better understanding of tensorflow at some point, and are not relevant to the operation of the system. Another possibility is that this folder was used in the retraining of the neural network, as I have not seen another file such as retrain.py anywhere, but I can not find any documentation on the real reason behind having this folder here. Another note is that the code in label_image.py is very similar to the ./classify_image.py file. The only other thing in the folder is the __pycache__ folder, which contains three .pyc files from compiling the .py files in the scripts folder.

sonar.ino

This is a file for when the rangefinder was controlled via arduino, according to the comments in it. The code is commented somewhat, but basically this file is just the loop reading from the rangefinder, which is now done in record.py

usbfs.sh

It's a one line script with no apparent use. I think its supposed to try to execute the sudo command, and echo 0 if it fails, but I am not familiar with scripting. The tee command takes standard input and outputs it to stdout and a file, so it could be pasting the 0 from the echo command into a file. The comment on it says “added command to prevent memcpy error when initializing xIQ camera”, so it might be just be called by another file.