나는 질병 인식을 다루는 프로젝트를 가지고있다. 우리는 C#을 사용해야합니다. 나무가 감염되었는지 여부를 어떻게 결정해야합니까? 나는 협정을 사용하고있다. 이미징 된 상관 관계 값이 너무 높습니다. 여기 샘플 이미지를이다 우측 : 감염; 왼쪽 : 건강/감염되지 않음이미지 텍스처 인식 C#
1
A
답변
0
Accord.NET을 사용하고 있다고 언급 했으므로 the examples for Bag-of-Visual-Words을 살펴볼 수 있습니다. 좀 더 구체적으로 말하면 텍스처 인식에 대해 언급했기 때문에 이미지에서 텍스처 피쳐 추출에 Haralick 피처 설명자를 사용하는 BoVW 예제를 고려해야합니다. 이 예는 아래의 재현 :
// Ensure results are reproducible
Accord.Math.Random.Generator.Seed = 0;
// The Bag-of-Visual-Words model converts images of arbitrary
// size into fixed-length feature vectors. In this example, we
// will be setting the codebook size to 3. This means all feature
// vectors that will be generated will have the same length of 3.
// By default, the BoW object will use the sparse SURF as the
// feature extractor and K-means as the clustering algorithm.
// In this example, we will use the Haralick feature extractor.
// Create a new Bag-of-Visual-Words (BoW) model using Haralick features
var bow = BagOfVisualWords.Create(new Haralick()
{
CellSize = 256, // divide images in cells of 256x256 pixels
Mode = HaralickMode.AverageWithRange,
}, new KMeans(3));
// Generate some training images. Haralick is best for classifying
// textures, so we will be generating examples of wood and clouds:
var woodenGenerator = new WoodTexture();
var cloudsGenerator = new CloudsTexture();
Bitmap[] images = new[]
{
woodenGenerator.Generate(512, 512).ToBitmap(),
woodenGenerator.Generate(512, 512).ToBitmap(),
woodenGenerator.Generate(512, 512).ToBitmap(),
cloudsGenerator.Generate(512, 512).ToBitmap(),
cloudsGenerator.Generate(512, 512).ToBitmap(),
cloudsGenerator.Generate(512, 512).ToBitmap()
};
// Compute the model
bow.Learn(images);
bow.ParallelOptions.MaxDegreeOfParallelism = 1;
// After this point, we will be able to translate
// images into double[] feature vectors using
double[][] features = bow.Transform(images);
대신 wood
및 cloud
질감 생성기를 사용하여 images
변수를 만드는, 당신의 문제에이 예제를 적용하려면 이미지를 자신의 데이터베이스를 검색 할 수 있습니다.
// Now, the features can be used to train any classification
// algorithm as if they were the images themselves. For example,
// let's assume the first three images belong to a class and
// the second three to another class. We can train an SVM using
int[] labels = { -1, -1, -1, +1, +1, +1 };
// Create the SMO algorithm to learn a Linear kernel SVM
var teacher = new SequentialMinimalOptimization<Linear>()
{
Complexity = 100 // make a hard margin SVM
};
// Obtain a learned machine
var svm = teacher.Learn(features, labels);
// Use the machine to classify the features
bool[] output = svm.Decide(features);
// Compute the error between the expected and predicted labels
double error = new ZeroOneLoss(labels).Loss(output); // should be 0
PS : 당신은 당신의 데이터 세트의 이미지의 각각의 특징 표현을 추출한 후 나중에, 당신은 유사한 코드를 사용하여, 이러한 지원 벡터 기계와 같은 기계 학습 분류를 배우고 그 표현을 사용할 수 있습니다 : 선형 대신 ChiSquare kernel으로 SVM을 만드는 것을 고려하면 분류 문제에서 더 나은 성능을 얻을 수 있습니다.