-
Notifications
You must be signed in to change notification settings - Fork 0
Tactigon CLI
Tactigon CLI enables the user - who has a valid license - to record and generates his/her own gesture models for gesture recognition.
To run the Tactigon CLI open a command window (cmd/powerShell in Windows, terminal windows for all the others O.S.) and run the python script cli.py with the following command:
python cli.py
The following menu will appear:
Gear SDK Client, select an option:
Enter 0 to test server connection
Enter 1 to data collection
Enter 2 to send data to server
Enter 3 to train a new model
Enter 4 to download a model from server
Type anything to EXITRegardless of chosen menu item, system is ready to use when showing message reporting successfully connection to Tactigon Skin. Before start using the SDK user needs to change the config files according to his needs. Linux/raspberry users: if working in SSH shell you may need to specify a DISPLAY with something like this:
export DISPLAY=:0.0
Before using the SDK some general information must be set in the two following config files:
user_data.json : Locally store login information. Need to match credentials on the server side
{
"user_name": "joe",
"auth_key": "_abcde123456__"
}hal.json : This config file store all necessary hardware related information
{
"BLE_RIGHT_ADDRESS": "BE:A5:7F:47:54:65", # Tactigon Right BLE Address (See Find Tactigon BLE Address section)
"BLE_LEFT_ADDRESS": "BE:A5:7F:47:54:65", # Tactigon Left BLE Address (See Find Tactigon BLE Address section)
"BLE_RIGHT_ENABLE" : "True", # Tactigon Right enable flag
"BLE_LEFT_ENABLE" : "True", # Tactigon Left enable flag
"SERIAL_COM_PORT": "COM3", # No need to change - debug
"NUM_SAMPLE": 10, # No need to change - debug
"INTERFACE" : "Bluetooth" # No need to change - debug
}client.json : This config file store http client related information
{
"SERVER_URL": "https://tgear.eu.pythonanywhere.com", # Tactigon Gear Server IP Address
"TRAINING_SESSIONS": ["26_02_2021_1", "26_02_2021_2"], # list of session to upload (see Training section)
"MODEL_SESSIONS": ["26_02_2021_1", "26_02_2021_2"], # list of session for model building (see Model Building section)
"MODEL_GESTURES": ["circle", "square"], # list of gestures recognized by the model (see Model Building section)
"MODEL_NAME": "MODEL_RIGHT", # name assigned to the requested model (see Model Building section)
"MODEL_DATA_PATH": "data/models/", # No need to change
"USER_DATA_PATH": "config_files/user_data.json", # No need to change
"RES": { # No need to change - debug
"user": " ", # No need to change - debug
"password": " ", # No need to change - debug
"status": "unsuccessful" # No need to change - debug
}Before running a training session the /config_files/data_collection.json data must be edited:
data_collection.json : This config file store all necessary information for data collection
{
"RAW_DATA_PATH": "./data/raw/", # path where you want to store raw data - no need to change
"GESTURE_NAME": ["square_cw","circle_acw"], # list of gestures you want to record
"SESSION_INFO": "19_02_2021_A", # recording session information
"HAND": "RIGHT" # which hand is going to be used (right/left)
}Steps:
- Run the
cli.pypython script - Select option 1
Enter 1 for data collection - Wait for te Tactigon to be connected
- Follow console instructions to train all the gestures entered in the data_collection.json config file
Once user has run one or more training session (even with different gesture sets), training data can be uploaded to the server and used later on to generate a Model. To do that follow the instructions below:
- Edit the "TRAINING_SESSIONS" field int the
client.jsonconfig file including all the sessions that user wants to upload to the server. Session are indicated by the "SESSION_INFO" field in thedata_collection.jsonconfig file used during training. - Run the
cli.pypython script - Check server connection select option 0
Enter 0 to test server connection - Select option 2
Enter 2 to send data to server
- Edit the "MODEL_SESSIONS" field int the
client.jsonconfig file including all the sessions that user wants to use for building the model. Session are indicated by the "SESSION_INFO" field in thedata_collection.jsonconfig file used during training. - Edit the "MODEL_GESTURES" field int the
client.jsonconfig file including all the gestures that the model has to recognise. - Edit the "MODEL_NAME" field int the
client.jsonconfig file to assign a name to the generated model. - Run the
cli.pypython script - Check server connection select option 0
Enter 0 to test server connection - Select option 3
Enter 3 to train a new model - A new model is created on server side and stored to DataBase
- Edit the "MODEL_NAME" field int the
client.jsonconfig file to select the model to download from server. - Select option 4
Enter 4 to download model from server
To test your new model you must copy the model.pickle and encoder.pickle files from the download folder ./data/models/<model name> inside of the ./examples/gesture directory.
- Edit the
./examples/gesture/app.pyfile and set the gesture you have recorded in your model - Run the
./examples/gesture/app.pypython script - Recognized gestures will be printed on the terminal