Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIMBA STRING ERROR: read_video_info video_name should be an string #402

Open
DanieleRomeo opened this issue Nov 19, 2024 · 5 comments
Open

Comments

@DanieleRomeo
Copy link

Hi,

I am using the version 2.3.5 of Simba and when I am trying to extract the features, I got this error:

SIMBA STRING ERROR: read_video_info video_name should be an string in SimBA, but is set to Video fps ... Distance_in_mm pixels/mm
0 LB4_NonRes_el 30 ... 500 3.43410
1 TL9_NonRes_el 30 ... 500 3.65800
2 LB1_NonRes_el 30 ... 500 3.55211
3 LB9_NonRes_el 30 ... 500 2.96602
4 LQ4_NonRes_el 30 ... 500 3.60406
5 LR3_NonRes_el 30 ... 500 3.71000
6 LR1_NonRes_el 30 ... 500 3.55800
7 TL4_NonRes_el 30 ... 500 3.60018
8 TB10_NonRes_el 30 ... 500 3.35210
9 LQ7_NonRes_el 30 ... 500 3.07403
10 LP6_NonRes_el 30 ... 500 3.26612
11 TL5_NonRes_el 30 ... 500 3.54423
12 HP8_NonRes_el 60 ... 500 3.29814
13 LD8_NonRes_el 30 ... 500 3.46807
14 LP1_NonRes_el 30 ... 500 3.52405
15 LP8_NonRes_el 30 ... 500 3.20423
16 LD10_NonRes_el 30 ... 500 3.46213
17 TB4_NonRes_el 30 ... 500 3.26801
18 LR7_NonRes_el 30 ... 500 3.35822
19 HP5_NonRes_el 59 ... 500 3.33200
20 LD1_NonRes_el 30 ... 500 3.44000
21 TB9_NonRes_el 30 ... 500 3.40001
22 LQ1_NonRes_el 30 ... 500 2.19505

[23 rows x 6 columns] ??

I tried to remove the numbers and the "_" from the name of the videos, but it didn't change. I tried also to set as text the Video column but it didn't work.
It seems a bit strange to me since with the version 1.90.2 I've never had this problem using the same videos name, and also the generated file video_info.csv is the same.

Could you please help me to fix it?

Thanak you so much for your time!

@sronilsson
Copy link
Collaborator

Hi @DanieleRomeo ! Thanks for reporting this and let's fix it ASAP. Can you send me a screenshot of the error message as it appears in the operating system terminal, as well as the /project_folder/csv/logs/video_info.csv and I will fix whatever is going on, and insert a more interpretable error message?

From the table, it appears that the header of the file is missing, and for some reason SimBA interprets the header line as a video parameter row.

@DanieleRomeo
Copy link
Author

Thank you so much for your fast reply!
This is the screenshot in the terminal:

Exception in thread Thread-2:
Traceback (most recent call last):
File "/home/fishlab4/anaconda3/envs/Simba/lib/python3.6/site-packages/simba/utils/checks.py", line 142, in check_str
t.String(allow_blank=allow_blank).check(value)
File "/home/fishlab4/anaconda3/envs/Simba/lib/python3.6/site-packages/trafaret/base.py", line 115, in check
return self.check_and_return(value)
File "/home/fishlab4/anaconda3/envs/Simba/lib/python3.6/site-packages/trafaret/base.py", line 507, in check_and_return
self._failure(self.TYPE_ERROR_MESSAGE, value=value, code=self.TYPE_ERROR_CODE)
File "/home/fishlab4/anaconda3/envs/Simba/lib/python3.6/site-packages/trafaret/base.py", line 140, in _failure
raise DataError(error=error, value=value, trafaret=self, code=code)
trafaret.dataerror.DataError: value is not a string

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/fishlab4/anaconda3/envs/Simba/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/home/fishlab4/anaconda3/envs/Simba/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/home/fishlab4/anaconda3/envs/Simba/lib/python3.6/site-packages/simba/ui/tkinter_functions.py", line 436, in execute_command
cmd(**evaluated_kwargs)
File "/home/fishlab4/anaconda3/envs/Simba/lib/python3.6/site-packages/simba/SimBA.py", line 720, in run_feature_extraction
custom_feature_extractor.run()
File "/home/fishlab4/anaconda3/envs/Simba/lib/python3.6/site-packages/simba/utils/custom_feature_extractor.py", line 198, in run
spec.loader.exec_module(user_module)
File "", line 678, in exec_module
File "", line 219, in _call_with_frames_removed
File "/home/fishlab4/Desktop/SimbaNonResFinal/project_folder/two_fish_feature_extractor_040924.py", line 149, in
feature_extractor.run()
File "/home/fishlab4/Desktop/SimbaNonResFinal/project_folder/two_fish_feature_extractor_040924.py", line 45, in run
video_info, self.px_per_mm, self.fps = read_video_info(self.video_info_df, self.file_name)
File "/home/fishlab4/anaconda3/envs/Simba/lib/python3.6/site-packages/simba/utils/read_write.py", line 597, in read_video_info
check_str(name=f'{read_video_info.name} video_name', value=video_name, allow_blank=False)
File "/home/fishlab4/anaconda3/envs/Simba/lib/python3.6/site-packages/simba/utils/checks.py", line 146, in check_str
raise StringError(msg=msg, source=check_str.name)
simba.utils.errors.StringError: SIMBA STRING ERROR: read_video_info video_name should be an string in SimBA, but is set to Video fps ... Distance_in_mm pixels/mm
0 LDotNonResel 30 ... 500 3.47404
1 LBunNonResel 30 ... 500 3.53411
2 LDunNonResel 30 ... 500 3.41519
3 TLquNonResel 30 ... 500 3.60822
4 LPseNonResel 30 ... 500 3.22400
5 TBdiNonResel 30 ... 500 3.32282
6 LRtrNonResel 30 ... 500 3.71642
7 TBnoNonResel 30 ... 500 3.42207
8 LDdiNonResel 30 ... 500 3.48606
9 LBquNonResel 30 ... 500 3.47001
10 TLnoNonResel 30 ... 500 3.64809
11 LQseNonResel 30 ... 500 3.06275
12 TLciNonResel 30 ... 500 3.58025
13 LQunNonResel 30 ... 500 2.16748
14 LRunNonResel 30 ... 500 3.57001
15 TBquNonResel 30 ...
500 3.28400
16 LBnoNonResel 30 ... 500 2.95661
17 LPotNonResel 30 ... 500 3.18428
18 LQquNonResel 30 ... 500 3.51400
19 LRseNonResel 30 ... 500 3.37999
20 LPunNonResel 30 ... 500 3.46600
21 HPciNonResel 30 ... 500 3.30800
22 HPotNonResel 30 ... 500 3.30404

[23 rows x 6 columns]

This is the output from the GUI (I cut the interpolation part of all the data):

SIMBA COMPLETE: 23 data file(s) interpolated) (elapsed time: 14.3869s) 🚀
Extracting features from 23 file(s)...
SIMBA STRING ERROR: read_video_info video_name should be an string in SimBA, but is set to Video fps ... Distance_in_mm pixels/mm
0 LDotNonResel 30 ... 500 3.47404
1 LBunNonResel 30 ... 500 3.53411
2 LDunNonResel 30 ... 500 3.41519
3 TLquNonResel 30 ... 500 3.60822
4 LPseNonResel 30 ... 500 3.22400
5 TBdiNonResel 30 ... 500 3.32282
6 LRtrNonResel 30 ... 500 3.71642
7 TBnoNonResel 30 ... 500 3.42207
8 LDdiNonResel 30 ... 500 3.48606
9 LBquNonResel 30 ... 500 3.47001
10 TLnoNonResel 30 ... 500 3.64809
11 LQseNonResel 30 ... 500 3.06275
12 TLciNonResel 30 ... 500 3.58025
13 LQunNonResel 30 ... 500 2.16748
14 LRunNonResel 30 ... 500 3.57001
15 TBquNonResel 30 ... 500 3.28400
16 LBnoNonResel 30 ... 500 2.95661
17 LPotNonResel 30 ... 500 3.18428
18 LQquNonResel 30 ... 500 3.51400
19 LRseNonResel 30 ... 500 3.37999
20 LPunNonResel 30 ... 500 3.46600
21 HPciNonResel 30 ... 500 3.30800
22 HPotNonResel 30 ... 500 3.30404

[23 rows x 6 columns] 🚨

Here is the video_info.csv file:
video_info.csv

I was also struggling with uploading Boris csv file, when I realize the problem was the separator used. My pc was using ";" as separator (it could be related to the geographic region of my account) while Boris csv output uses ",", so when I modified the Boris file to adjust the video path and I saved as csv, the separator was changed and Simba was not able to detect the boris file. When I find out and I managed to fix the separator, Simba was able to read the csv.

However, I didn't change the video_info.csv since it is automatic generated by Simba, so I don't know if this could be also related to the separator of csv.

Thank you so much again for your help!

@sronilsson
Copy link
Collaborator

sronilsson commented Nov 20, 2024

@DanieleRomeo Yes, I think I found the issue.

The quickest way to solve it:

In your two_fish_feature_extractor_040924.py file, open it in a text editor, and go to line 45, and you should see this below text:

video_info, self.px_per_mm, self.fps = read_video_info(self.video_info_df, self.file_name)

To fix it, change the order of self.video_info_df, self.file_name arguments so that the line instead reads:

video_info, self.px_per_mm, self.fps = read_video_info(self.file_name, self.video_info_df)

Save the file, try again, and please let me know how it goes.

PS.
If you want to make sure the issue cannot appear again ever, pass the name of the variables, so that the line reads:

video_info, self.px_per_mm, self.fps = read_video_info(video_name=self.file_name, video_indo_df=self.video_info_df )

@DanieleRomeo
Copy link
Author

Great that was the issue! Thank you so much again, now it works fine.

I had to remove "animal_name" from parts of the script such as
bp_arr = self.data[[f'{animal_name}_{body_part_name}_x', (line 53)
since I got this error "KeyError: "None of [Index(['Cleaner_BodyMidUp_1_x', 'Cleaner_BodyMidUp_1_y'], dtype='object')] are in the [columns]"
But after that it is working fine!

Thank you again for your help!

@sronilsson
Copy link
Collaborator

Thanks for letting me know @DanieleRomeo - I don't know why you had to remove the animal name, I don't think it will cause any issues downstream though. But should you get any errors please let me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants