More troubleshooting questions with post-DLC analysis

@jeylau @MWMathis Hello again! I don’t understand what seems to be an error. You’ll see with the screenshots. The key error only mentions the DLCscorer. My DLCscorer is “C:\Users\aven1791\.ipython\fiveminutes-aven1791-2020-12-08\videos\fiveminutesDLC_resnet50_fiveminutesDec8shuffle1_27500”. What is this supposed to mean?

Here is the code that I pasted onto the Console:
image

Here is what errors I have. What does this supposed to mean?

@jeylau @MWMathis
To be more specific, I tried putting the exact code for Dataframe and DLCscore respectively. I still get the same error message.

Once again, I don’t think I was really specific with my question. I don’t understand why my error is only listing one of the files, which is the DLC. How come? As always, I’d greatly appreciate anybody’s help!

Best,
Ryan

DLCscorer should be “DLC_resnet50_fiveminutesDec8shuffle1_27500” not the whole path

I did the whole path in order for the Console to understand the files better. I tried just the name of the DLCscorer as you mentioned, but I still get the same problem.

Oh, nevermind. It seemed to have worked. However, I see that snout is the issue now. How did this happened?

First of all, I’d advise not to use console to run this script and use an IDE - spyder is very begginer friendly in terms of controlling all your variables. I don’t see the final error, but I assume it’s KeyError: ‘snout’ so my guess would be there is no snout label in this dataset you try to analyze?

I now have the error “array must not contain infs or NaNs.”

How could I edit the code based on the error?

import time_in_each_roi 


bpt='objectA'
vel = time_in_each_roi.calc_distance_between_points_in_a_vector_2d(np.vstack([Dataframe[r"DLC_resnet50_fiveminutesDec8shuffle1_27500"][bpt]['x'].values.flatten(), Dataframe[r"DLC_resnet50_fiveminutesDec8shuffle1_27500"][bpt]['y'].values.flatten()]).T)

fps=30 # frame rate of camera in those experiments
time=np.arange(len(vel))*1./fps
vel=vel #notice the units of vel are relative pixel distance [per time step]

# store in other variables:
xobjectA=Dataframe[r"DLC_resnet50_fiveminutesDec8shuffle1_27500"][bpt]['x'].values
yobjectA=Dataframe[r"DLC_resnet50_fiveminutesDec8shuffle1_27500"][bpt]['y'].values
vobjectA=vel

Further, I get the same issues if I use Spyder.

For clarification, the following code recently listed is the one that led to the error.

Looking at the code you send, you call Dataframe (but as far as i can see there is no Dataframe variable anywhere) so you call nothing to make an array of nothing. If you use provided example code, use it in full since you just miss steps. Plus the vel=vel doesn’t do anything.

@Konrad_Danielewski ; The code I presented is just an excerpt of the project I’m working on (sorry for not making this clear). Dataframe has already been defined from the very beginning. Also, why wouldn’t vel=vel do anything?

You say that variable equals itself, which is true but why would it do anything? It’s true so the code works but if you remove it nothing will change. There is a problem with your variables, the dataframe is either non existent or empty. The code you use works for sure, the only issue can be from what you input into it.

Thanks. So what would you recommend I change or edit given from the last code I put on the discussion board?

As I said, the code is correct it’s the dataframe you input that’s a problem. Check the dataframe you load, print it or open in spyder.