4

我只是好奇。我是新来的,所以请体谅我这个有点幼稚的问题。

假设我正在做带有图像识别的 android 应用程序,其中所有进程甚至计算密集型都必须发生在移动设备 cpu 上。

我正处于已经处理图像的阶段,从图像中提取了一些特征。这组图像仅来自一个建筑物,它应该识别特定的感兴趣对象(不同的窗户、图片、人工制品、建筑物外部)。所以这是一个封闭的领域,我可以提供足够多的不同角度的物体图片。我计划训练神经网络并将其提供给应用程序而不是图像匹配算法。

我的想法是提取关键点,计算描述符(将 FREAK 用于关键点 ORB 用于描述符)并从这些描述符中得到我希望得到单个文件或数组的最终结果是这样的

    Desc1  Desc2 Desc3 Desc4 DescN......... Class
_________________________________________________________________________________
Picture 1     0.121  0.923 0.553 0.22  0.28           "object1" 
Picture 2     0.22    0.53  0.54 0.55  0.32 .........."object1" (different scale, angle)
Picture 3     ....    ...    ...   ...  ..   .........."object2"
Picture N
Picture N+1

所以我可以把它交给神经网络进行训练,但是我被卡住了,因为我不知道矩阵中的二进制特征/描述符是如何表示的(Class Mat - openCV)。以及我将如何继续对这些二进制描述符进行规范化,以便将其提供给神经网络(多层感知器)进行训练。(即使是伪代码也会有很大帮助)

4

2 回答 2

2

I can not give a complete answer to your question, because I'm not familiar with Neuronal Networks, but I can give you some ideas about ORB descriptors binary representation.

  1. When you are detecting keypoints you can't do it with FREAK. But as FREAK paper describes you should detect keypoints with FAST corner detector and then describe it with FREAK. If you want to recognize objects by ORB descriptors, you should use ORB for both, for keypoint detection and for description. Note that ORB keypoint detection is also can be based on FAST. You can change it by altering parameter of scoreType from OpenCV documentation. As you using android, you can set this parameter as described here

  2. About binary string descriptors. I also needed them to implement descriptor matcher with MySQL query. As Mat in OpenCV-java has only double descriptor representation, I've implemented the method to transform them to binary. For this purpose, the Mat of descriptors should be transformed to List<Double>. And you can use my function to obtain binary representation of descriptors. The function will return the List<String>.

Here is the code:

public static List<String> descriptorToBinary(List<Double> desc){

    List<String> binary_desc = new ArrayList<String>();

    String desc_bin= "";
    for(int i = 0; i < desc.size(); i++){

        String binary_str_tmp = Integer.toBinaryString((int)((double)desc.get(i)));
        if (binary_str_tmp.length() < 16)
        {
            int number_of_zeros = 16 - binary_str_tmp.length();
            String str_tmp = "";
            for(int t = 0; t < number_of_zeros; t++){
                str_tmp += "0";
            }
            binary_str_tmp = str_tmp + binary_str_tmp;
        }

        desc_bin+= binary_str_tmp;
        binary_desc.add(final_binary_str);

    }

    return binary_desc;

}

The returned list of strings will have the same size as list of MatOfKeyPoint if you will transform it to List<KeyPoint>

So how did I verified if these descriptors are correct:

  1. I've matched original Mat descriptors with Bruteforce Hamming matcher as was said in ORB paper
  2. I've registered the distances returned by matcher.
  3. Then I've calculated distances distances between String descriptors of the same image.
  4. Verified if opencv's Hamming distances were the same as distances between String descriptors. They were the same, so conversion from Mat to List was well performed.

So binary descriptors associated to keypoints will look like this:

Picture 1: object1
  keypoint1 : 512bit binary descriptor (1s and 0s)
  keypoint2 : 512bit binary descriptor
  keypoint3 : 512bit binary descriptor
  ...
Picture 2: object2
  keypoint1 : 512bit binary descriptor
  keypoint2 : 512bit binary descriptor
  keypoint3 : 512bit binary descriptor
  ...

Now about Multi-Layer Perceptron. I can not help you with it. That is why I've told at the start that my answer is incomplete. But I hope the comments that I've given will help you in future to sole your problem.

于 2013-05-27T14:58:06.033 回答
2

而不是尝试从头开始实现分类器。您是否考虑过 HaarTraining?您可以训练它来检测图像中的多个对象。

但是,培训过程很长。

http://note.sonots.com/SciSoftware/haartraining.html

希望能帮助到你!

于 2013-05-09T22:29:25.873 回答