1
votes

I am using random forest function in scikit learn for segmentation of image. However i am not able to create an input to the function clf.fit(X,Y). X is a training matrix of (n_samples,n_features), Y is a target matrix of (n_samples,) in which the last attribute is the labels of the target class. I want to train 50 images with four-five features, like HOG features,RGB features,f17 filter and texon map.

Can anyone please help me create the matrix X and Y. Thanks!

1
Are you using a RandomForestClassifier to classify pixel-wise for your segmentation? You need to be more specific about what your doing, and add some example code.Matt Hancock
Just to give you an idea. You usually need 1000s of images to train something really simple like recognizing black digits on a black background. With only 50 images you won't get meaningful results. And a feature for an image is one pixel. Meaning a 50x50 pixel with rgb has 750 features.Zephro

1 Answers

1
votes

If you're just classifying each pixel on its own, just put the rgb values into X and the segment as Y.

Something likely better though would be to pick a small region around the pixel, and either use near neighbors rgb values - all concated from left to right in each row, or the distributions of each of r,g,b within a local region.