BehaviorScope Software for Parsing Human Activities Using PCFG

Here you can find a command line of the BehaviorScope software for parcing human activities using sensory grammars.

The idea behind sensory grammars is presented in the IEEE Proceedings article that you can find attached (proc_ieee.pdf). A manual describing the system can be found in the BehaviorScope_Architecture.pdf file. The actual software can be found in the BehaviorScope_command_line_SERVER.zip.

 

Installation

The software has been tested with Python 2.5 and the Natural Language Tool-Kit (NLTK) with version at least 0.7. You will also need a mysql database server, and some additional Python packages as python-mysql (MySQLdb), python-matplotlib and python-numpy.

In the attached files bscope_sample_dataset.sql and bscope_sample_dataset.csv (please, note that drupal has appended a .txt extensions to these files) you can find a sample trace for the activity of a person collected using motion (PIR) sensors (a floorplan with the locations of the sensors can be found at floorplan.jpg). Although, the data has been cleaned, there are still certain occasions where the trace contains erroneous measurements or more than one persons in the house. To set up a mysql database for use with the BehaviorScope software, you will have to create a new database (for example):

CREATE DATABASE bscope_data;

give rights to the database to a user:

GRANT ALL PRIVILEGES ON bscope_data.* TO 'user'@'%' IDENTIFIED BY 'pass' WITH GRANT OPTION;

and then import the data to the database. In order to do so using the .sql file you can use the command:

mysql -u user -p bscope_data < bscope_sample_dataset.sql

The previous command will create a table with name data in the database. In general, the current supported table format is "row id" (BIGINT UNSIGNED PRIMARY KEY), "address" (SMALLINT UNSIGNED), "start_time" (DATETIME), "end_time" (DATETIME).

 

Running The Grammars

You can run BehaviorScope from the command line as follows:

> python runBehaviorScope.py -s <server> -u <user> -p <password> -d <database> -t <table> -n <# of phonemes to be read> -S <0 or 1>

In order to run the software without getting any errors you have to specify all the parameters:

-s: the server where the database is located (for now: atlantis.eng.yale.edu)

-u: username for the database (for now: boston)

-p: password for the database (for now: pass)

-d: database name (for now: boston_gumstix or cyprus)

-t: table name where the phonemes are stored (for now: SimTransCont)

-n: the number of phonemes to be read from the end of the table. When you run the BehaviorScope for first time and you already have a huge amount of data in the database you do not want to parse all of them. This number will define the number of the most recently recorded phonemes that will be parsed immediately when the program starts.

-S: 1 if this program is called for the first time. 0 if it has been called before and you want to continue from where the program stopped last time. If for any reason the software is stopped or crashed, you can re-run the software by setting this flag to 0. Doing so, the software will resume from where it stopped before crashing automatically.

After the program parses the latest batch of phonemes, it will go to sleep for a minute and then it will immediately check for updates in the database. if there are updates, the new batch of phonemes will be fetched and parsed. After this phase is done, the program goes back to sleep for a minute and so on.

The user defines the grammar hierarchies to be run, as well as the notifications to be sent (e-mail, cell-phone messages) using two configuration files: BehaviorScope.config and Notifications.config respectively. To see the structure of the files take a look at the BehaviorScope architecture description/manual as well as at the files generated by the GUI-based versions. The output for every grammar hierarchy and notification is recorded automatically on the database under the tables Activities and Notifications respectively.

AttachmentSize
proc_ieee.pdf4.51 MB
BehaviorScope_Architecture.pdf4.83 MB
BehaviorScope_command_line_SERVER.zip46.52 KB
bscope_sample_dataset.sql_.txt1.61 MB
bscope_sample_dataset.csv_.txt1.58 MB
floorplan.jpg116.31 KB