Closed antortjim closed 4 years ago
Hi Antonio - you cannot export all snapshots on a pi because it's too computationally intensive and it probably halts your tracking too. 1/10 of a second is faster than tracking in even normal conditions so you don't even have enough images with that frequency.
I would suggest instead to save a video offline and then track the video instead of live. You will then be able too sync those together and review the process.
On Wed, 25 Sep 2019, 11:29 Antonio, notifications@github.com wrote:
Dear Gilestrolab
I would like to extend the debugging capabilities of the ethoscope by 1) exporting all snapshots and 2) ideally partially processed frames, so I can more clearly understand what does the ethoscope tracking algorithm receive as input and correlate it to its output.
In order to achieve 1) I changed the default period to 0.1 in ImgToMySQLHelper's init function https://github.com/gilestrolab/ethoscope/blob/f692e7c973b54e1aa1580f198aa836fb7faa99b6/src/ethoscope/utils/io.py#L154 so any new snapshot within 1/10 of a second is saved instead
In order to achieve 2) I
Changed the _create_table call that initializes the IMG_SNAPSHOTS table
self._create_table("IMG_SNAPSHOTS", "id INT NOT NULL AUTO_INCREMENT PRIMARY KEY , t INT, img LONGBLOB, img_debug LONGBLOB, success INT")
Added the logic that creates the img_debug image and inserts it in the sql (obtain the image, imwrite it to a temp file, read it as a bstring and modify the command and arguments to _write_async_command()).
cmd = 'INSERT INTO ' + self._table_name + '(id,t,img,img_debug,success) VALUES(%s,%s,%s,%s,%s)' args = (0, int(t), bstring, bstring_debug, success)
success is either 1 if the bstring_debug can be obtained and 0 otherwise.
However, the resulting db file always contains NULL on the new fields (not on id,t and img). I tried querying the sql database locally from the ethoscope (via ssh) and they don't show as NULL there. I get a long random string if I run:
mysql -u ethoscope -p + enter password (ethoscope) + USE ethoscope_db; + SELECT img_debug FROM IMG_SNAPSHOTS LIMIT 1;
I don't know what's wrong with my procedure. Could you enlighten me with what I should do in order to add new fields to IMG_SNAPSHOTS? Thank you!
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/gilestrolab/ethoscope/issues/104?email_source=notifications&email_token=AAFKERP4SMDQKV2G7SZ3V5TQLM4PPA5CNFSM4I2K3J5KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HNR3UDA, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFKERP7Q2NLSC3E52OWG2TQLM4PPANCNFSM4I2K3J5A .
TLDR
I tried adding more fields to the IMG_SNAPSHOTS table but the new values on the resulting db files are set to NULL in the copy downloaded in the node. However, they are not NULL when I query them locally from the ethoscope via the mysql client. There is a bug somewhere preventing me from getting the extra fields with the correct values. Could you explain briefly what would be the procedure to add new fields to this table?
Long question
Dear Gilestrolab
I would like to extend the debugging capabilities of the ethoscope by 1) exporting all snapshots and 2) ideally partially processed frames, so I can more clearly understand what does the ethoscope tracking algorithm receive as input and correlate it to its output.
In order to achieve 1) I changed the default period to 0.1 in ImgToMySQLHelper's init function https://github.com/gilestrolab/ethoscope/blob/f692e7c973b54e1aa1580f198aa836fb7faa99b6/src/ethoscope/utils/io.py#L154 so any new snapshot within 1/10 of a second is saved instead
In order to achieve 2) I
Changed the
_create_table
call that initializes the IMG_SNAPSHOTS table https://github.com/gilestrolab/ethoscope/blob/f692e7c973b54e1aa1580f198aa836fb7faa99b6/src/ethoscope/utils/io.py#L356 toAdded the logic that creates the img_debug image and inserts it in the sql (obtain the image, imwrite it to a temp file, read it as a bstring and modify the command and arguments to
_write_async_command()
). https://github.com/gilestrolab/ethoscope/blob/f692e7c973b54e1aa1580f198aa836fb7faa99b6/src/ethoscope/utils/io.py#L187 https://github.com/gilestrolab/ethoscope/blob/f692e7c973b54e1aa1580f198aa836fb7faa99b6/src/ethoscope/utils/io.py#L189success is either 1 if the bstring_debug can be obtained and 0 otherwise.
Edited the functions in mysql_backup.py to also take into account these new fields.
However, the resulting db file always contains NULL on the new fields (not on id,t and img). I tried querying the sql database locally from the ethoscope (via ssh) and they don't show as NULL there. I get a long random string if I run:
mysql -u ethoscope -p
+ enter password (ethoscope) +USE ethoscope_db;
+SELECT img_debug FROM IMG_SNAPSHOTS LIMIT 1;
I tried swapping the img and img_debug entries (i.e. providing my new bstring to img and the default one to img_debug) and my debugging frame replaces the original frame. This tells me that my logic for creating the bstring is correct, but for some reason I fail at adding more fields in the IMG_SNAPSHOTS table I don't know what's wrong with my procedure. Could you enlighten me with what I should do in order to add new fields to IMG_SNAPSHOTS? Thank you!