def test(): classifierLocation = "/home/amb/dev/mrf/classifiers/logisticRegression/superpixel/logReg_miniMSRC.pkl" classifier = pomio.unpickleObject(classifierLocation) carFile = "7_3_s.bmp" msrcData = "/home/amb/dev/mrf/data/MSRC_ObjCategImageDatabase_v2" car = pomio.msrc_loadImages(msrcData, ["Images/" + carFile])[0] groundTruth = car.m_gt mask = superPixels.getSuperPixels_SLIC(car.m_img, 400, 10) spLabels = SuperPixelClassifier.predictSuperPixelLabels( classifier, car.m_img, 400, 10, True)[0] prediction = SuperPixelClassifier.getSuperPixelLabelledImage( car.m_img, mask, spLabels) # save prediction to file pomio.writeMatToCSV(prediction, "/home/amb/dev/mrf/eval/testPrediction1.labels") results = evaluatePrediction(prediction, groundTruth, carFile) print "\nINFO: Car test eval results::\n\t", results classResults = evaluateClassPerformance(prediction, groundTruth) print "\nINFO: Car test eval class results::\n\t", classResults confusionResults = evaluateConfusionMatrix(prediction, groundTruth) print "\nINFO: Car test eval confusion matrix results::\n\t", "Just sum up entries... ", np.sum( confusionResults)
def test_superPixel_pixelFeatures(): sourceImage = readImageFileRGB("ship-at-sea.jpg") superPixelMask = superPixels.getSuperPixels_SLIC(sourceImage, 400, 10) superPixelRegionFeatures = getSuperPixelFeatures_pixel(sourceImage, superPixelMask) print "\nINFO: Shape of featuresBySuperPixel =" , np.shape(superPixelRegionFeatures) return superPixelRegionFeatures
def test_superPixelFeatures(): sourceImage = readImageFileRGB("ship-at-sea.jpg") superPixelMask = superPixels.getSuperPixels_SLIC(sourceImage, 400, 10) spFeatures = generateSuperPixelFeatures(sourceImage, superPixelMask, []) print "Shape of super pixel features =" , np.shape(spFeatures) numNanValues = np.sum( ((np.isnan(spFeatures) == True)[0]).astype('int') ) print "\n\nPost-processing total NaN values =", numNanValues
def test_superPixelFeatures(): sourceImage = readImageFileRGB("ship-at-sea.jpg") superPixelMask = superPixels.getSuperPixels_SLIC(sourceImage, 400, 10) spFeatures = generateSuperPixelFeatures(sourceImage, superPixelMask, []) print "Shape of super pixel features =", np.shape(spFeatures) numNanValues = np.sum(((np.isnan(spFeatures) == True)[0]).astype('int')) print "\n\nPost-processing total NaN values =", numNanValues
def test_superPixel_pixelFeatures(): sourceImage = readImageFileRGB("ship-at-sea.jpg") superPixelMask = superPixels.getSuperPixels_SLIC(sourceImage, 400, 10) superPixelRegionFeatures = getSuperPixelFeatures_pixel( sourceImage, superPixelMask) print "\nINFO: Shape of featuresBySuperPixel =", np.shape( superPixelRegionFeatures) return superPixelRegionFeatures