CPA TypeError on Score Image when using classifier that isn't "Fast Gentle Boosting"


#1

Hello CPA team!

When using the classifier in CPA I get the following error when trying to score an image using any trained classifier that isn’t “Fast Gentle Boosting”.

An error occurred in the program:
TypeError: ufunc 'isinf' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

Traceback (most recent call last):
  File "cpa\classifier.pyc", line 1460, in OnScoreImage
  File "cpa\classifier.pyc", line 1509, in ScoreImage
  File "cpa\generalclassifier.pyc", line 78, in FilterObjectsFromClassN
  File "cpa\multiclasssql.pyc", line 127, in FilterObjectsFromClassN
  File "cpa\multiclasssql.pyc", line 157, in processData
  File "numpy\lib\type_check.pyc", line 374, in nan_to_num
  File "numpy\lib\ufunclike.pyc", line 113, in isposinf

I also get a similar error when scoring all images, or when trying to fetch positive/negative/uncertain objects. The similarity is in the last 4 lines of the call stack. Looking at the source for cpa/multiclasssql.py, it looks like this try-except calls np.nan_to_num (which is raising the TypeError) once in both the try and except blocks. It may be that cell_data is not getting cleaned up properly before being passed to np.nan_to_num. For example, when np.nan_to_num is called on a numpy array containing a None, the above TypeError gets raised.

I didn’t see any issues related to this on the CPA GitHub page so I figured I’d share it here.

I’m on 64-bit Windows 8.1 and using the CPA nightly build. The error also occurs when using the current stable 2.2.1 CPA build.


#2

Thanks for reporting!
We filed this as an issue: https://github.com/CellProfiler/CellProfiler-Analyst/issues/178
and are working on it.

David


#3

Do you know what kind of data types are in your training set? https://github.com/CellProfiler/CellProfiler-Analyst/issues/178#issuecomment-216912363


#4

Let’s keep the discussion going on github https://github.com/CellProfiler/CellProfiler-Analyst/issues/178


#5

I would assume only floats but I’d have to check the data. I’m using the output of a pipeline that is based on the one published here.

I won’t be able to do that until mid next week but will get back to you.

Thanks!


#6

So I’ve installed the latest nightly (with commit 1ada1d6), loaded my training set, trained the classifier, and tried to score an image but hit the new exception: Exception: data type is object.

I’m going to guess this means there may be some missing values in the data exported from the CellProfiler pipeline? Is there an easy way to fill these or make sure the types are consistent in my data set?

Thanks again!


#7

I am using 2.2.1 stable and am also getting this error.

I followed page 16 of the training manual found at http://cellprofiler.org/outreach/

for " Image-based screening for quantifying a translocation assay written exercise"

I followed these steps:
• Change the number next to the word “Fetch” from “20” to “5”. Click on the drop-down box labeled “random” in the fetch controls. Select “positive” from the drop-down list.
• Click the “Fetch!” button to retrieve samples of what the computer thinks are positive cells based on the current set of rules.

This is the error I am getting:
An error occurred in the program:
TypeError: ufunc ‘isinf’ not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ‘‘safe’’

Traceback (most recent call last):
File “cpa\classifier.pyc”, line 989, in OnFetch
File “cpa\generalclassifier.pyc”, line 78, in FilterObjectsFromClassN
File “cpa\multiclasssql.pyc”, line 127, in FilterObjectsFromClassN
File “cpa\multiclasssql.pyc”, line 157, in processData
File “numpy\lib\type_check.pyc”, line 374, in nan_to_num
File “numpy\lib\ufunclike.pyc”, line 113, in isposinf


#8

There hasn’t been a release in a while (my guess is that will change soon), so this is still true in the stable; I believe the nightly should work though, you can download and try that.


#9

Hello CPA Team,

I am writing to find out if this issue has been resolved. I am having the same issues- any attempt to use anything other than Fast Gentle Booster results in a crash when trying to “Score All”. Unfortunately, Random Forest and Gradient Booster work much better.

Please let me know what info I can provide you to help resolve this issue. I literally have thousands of images waiting to be analyzed.

Keep up the good work!


#10

Hi,

Unfortunately CPA isn’t actually a funded project in the lab, it’s simply maintained as a labor of love (and because we think it’s super useful!); it has unfortunately meant it’s had to take a back seat while we’ve been pushing out things like the CellProfiler 3.0 release. Now that CP 3.0 is done, we’re hoping to get back to taking more looks at CPA in the near future.

In the meantime, it looks like while we haven’t had a new release in a while, this error has indeed been fixed in the code base; can you try installing from source and seeing if it works for you running from the latest master?

Thanks!


#11

Hi,

Thank you for the advice. I have been working on installing CP (and then CPA) from source following you instructions. I am admittedly a newbie on many of the steps. However, I think I have everything installed correctly for CP but I am receiving the error below. Any suggestions on where I went wrong? I used source code from 2.2 but 3.0 is giving me the same result. Also, just running the command without the --build-and-exit gives the same response. Thanks for the help.

error


#12

Can you tell me the result of typing in java -version ?


#13

java version “1.8.0_151”


#14

Here is the screen grab

error2


#15

Dear Bcimini,

I wanted to see if you any opinions on how to proceed?

Thanks,
John


#16

Is this a 32bit or 64bit machine? If 64, can you make sure that you have the 64 bit Java installed? When I run that command on my machine for example I get the following output:

java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)