RockStarCoders / alienMarkovNetworks

Using MRFs and CRFs for computer vision problems.
21 stars 9 forks source link

fix numeric errors in feature evaluation #18

Closed jsherrah closed 10 years ago

jsherrah commented 10 years ago

./testClassifier.py msrcFull_randForest_grid.pkl 3_7_s.bmp
Classifying file 3_7_s.bmp could be divide by zero

Computing super pixel labelling for input image image type = uint8 Image contains 363 superpixels /usr/lib/python2.7/dist-packages/scipy/stats/stats.py:1020: RuntimeWarning: invalid value encountered in divide vals = np.where(zero, 0, m3 / m21.5) /usr/lib/python2.7/dist-packages/scipy/stats/stats.py:1078: RuntimeWarning: invalid value encountered in divide vals = np.where(zero, 0, m4/ m22.0) INFO: processed 363 & skipped 0 superpixels. Type: <type 'numpy.ndarray'>

amb-enthusiast commented 10 years ago

The scipy.stats.skew() function was causing the invalid value runtime error in the divide by 0 case. I've added logic to FeatureGenerator.py to check for NaN values in superpixel features, and replace any NaN values with 10000. Tested this with the test_superPixelFeatures() funciton and all seems to be well. Let me know how this runs for you.

jsherrah commented 10 years ago

might be better to use 0? 10k is arbitrary and might overlap the value distribution?

amb-enthusiast commented 10 years ago

Done, changed to 0.