CVPR2014 objectness Source conversion (full version) VS2012 X64–>win32

Source: Internet
Author: User

One, version conversion

1. Convert the vs2012 X64 version in the source code to the vs2012 Win32 version.

2. Source download and related information download http://mmcheng.net/zh/bing/

3. Need to download source code (paper part) and VOC database (download part, more than 800 m)

PS:VOC best to download the author's, the author will modify the XML inside to fit the OPENCV operation of the yml file, direct download is no yo

4. All of the following settings are performed under Release and Debug is identical.

5.OpenCV recommended to use 2.4.8 version above, I use here is 2.4.8

Second, environmental settings

Source code is X64, please consciously Configure Manager , New--Add Win32

Viewing the property manager, you will find that there are two additional Win32 directories that were not previously available

Iii. compiling and generating LibLinear.lib files in the Liblinear project specific as follows:

1. Right-click Liblinear, select as Startup Project

2. In the Linear.cpp file, modify the Print_string_stdout function to:

extern "C" static void Print_string_stdout (const char *s)

3. Open the Release property page of the Liblinear project, general properties, generic, Modify: Configuration type, project default (Static library. Lib), general, target file extension (. lib)

4.c/c++-code generation –> Runtime, multithreading (/MT)

PS:MT corresponds to RELEASE,MTD corresponding to debug

5.CTRL+F5, the release file under the current project will be added to generate LibLinear.lib

6. Switch back to set the objectness as the startup project

7. Liblinear configuration is finished, the next configuration is for the objectness

8. Open the release properties, linker, attach library directory, add LibLinear.lib directory,

eg. E:\VS Workspace\bingobjectnesscvpr14\objectness\release

Note: The link library dependency is set to Yes (yes)  

Iv. using _popcnt function to realize _popcnt64 function function

You need to write your own function on the basis of the INT64 type. To add a header file #include <intrin.h> in stdafx.h .

Inline INT64 __popcnt64 (int64x) {       return __popcnt ((unsignedint) (x)) +__popcnt ((Unsignedint) (x>> 32));}
v. objectness configuration (simple and rough)

1. Open the Release Properties page

2. Configure OPENCV (Baidu a bit), note in the linker, input here to OpenCV all Lib included, or will report the following such errors:

Opencv_core248.lib (persistence.obj): Error LNK2019: unresolved external symbol _gzputs

3. Also add some system lib,gdi.lib (usually there will be), comctl32.lib, or you will report the following such errors:

Opencv_highgui248.lib (window_w32.obj): Error LNK2019: unresolved external symbol [email protected]

4.c/c++, preprocessor –> preprocessor definition add: _lib _crt_secure_no_warnings

5. C + + code generation –> Runtime Multithreading (/MT);

Otherwise, the following errors will be reported:

Error LNK2038: "RuntimeLibrary" mismatch detected: Value "Mt_staticrelease" Mismatch value "Md_dynamicrelease"

Enable function-level chaining---yes (/gy);

Streaming SIMD Extensions 2 (/ARCH:SSE2) with enhanced instruction set enabled

PS: First check your own CPU support SSE2, general i3 above can be, otherwise suggest change computer

6.c/c++, language->openmp support (/OPENMP)

configuration complete, absolutely simple rough!  

Six, the code mat cannot resolve the problem

The specific reason is not known for the time being, possibly a support issue for the INT64 (Unsignedlong long) type in OpenCV mat_,

You can replace the matchtemplate primitive function in the FilterBing.cpp file with the following matchtemplate () function. Run it yourself to see if there is a problem and then modify it.

void Filterbing::matchtemplate (const mat &AMP;MAG1U, Mat &matchcost1f) {const int H = mag1u.rows, W = Mag1u.cols; Const Size SZ (w+1, h+1);    Expand original size to avoid dealing with boundary conditions mat_<float> scores (SZ);    @ 2013.3.22 by Ly;    const int Sizesz = Sz.width * sz.height;    INT64 * TIG1 = (INT64 *) malloc (Sizesz * sizeof (INT64));    INT64 * Tig2 = (INT64 *) malloc (Sizesz * sizeof (INT64));    INT64 * Tig4 = (INT64 *) malloc (Sizesz * sizeof (INT64));    INT64 * Tig8 = (INT64 *) malloc (Sizesz * sizeof (INT64));    BYTE * Row1 = (BYTE *) malloc (Sizesz * sizeof (byte));    BYTE * Row2 = (BYTE *) malloc (Sizesz * sizeof (byte));    BYTE * Row4 = (BYTE *) malloc (Sizesz * sizeof (byte));    BYTE * Row8 = (BYTE *) malloc (Sizesz * sizeof (byte)); memset (Tig1, 0, Sizesz * sizeof (INT64));    memset (Tig2, 0, Sizesz * sizeof (INT64)); memset (Tig4, 0, Sizesz * sizeof (INT64));    memset (Tig8, 0, Sizesz * sizeof (INT64)); memset (Row1, 0, Sizesz * sizeof (byte)); memset (Row2, 0, Sizesz * sizeof (byte)); memset (Row4, 0, Sizesz * sizeof (byte));    memset (Row8, 0, Sizesz * sizeof (byte));        for (int y=1; y<= H; y++) {Const BYTE * G = Mag1u.ptr (y-1);        INT64 * T1 = Tig1 + y*sz.width;        INT64 * T2 = Tig2 + y*sz.width;        INT64 * T4 = Tig4 + y*sz.width;        INT64 * T8 = Tig8 + y*sz.width;        INT64 * Tu1 = Tig1 + (y-1) *sz.width;        INT64 * Tu2 = Tig2 + (y-1) *sz.width;        INT64 * Tu4 = Tig4 + (y-1) *sz.width;        INT64 * Tu8 = Tig8 + (y-1) *sz.width;        BYTE * R1 = Row1 + y*sz.width;        BYTE * R2 = Row2 + y*sz.width;        BYTE * R4 = Row4 + y*sz.width;        BYTE * R8 = Row8 + y*sz.width;        float *s = scores.ptr<float> (y);            for (int x=1; x<= W; x + +) {byte g = g[x-1]; R1[X] = (R1[x-1] << 1) |            (G >> 4) & 1); R2[X] = (R2[x-1] << 1) |            (g >> 5) & 1); R4[X] = (R4[x-1] << 1) |    (g >> 6) & 1);        R8[X] = (R8[x-1] << 1) |            (G >> 7) & 1); T1[X] = (Tu1[x] << 8) |            R1[X]; T2[X] = (Tu2[x] << 8) |            R2[X]; T4[X] = (Tu4[x] << 8) |            R4[X]; T8[X] = (Tu8[x] << 8) |            R8[X];        S[X] = dot (t1[x], t2[x], t4[x], t8[x]); }} free (TIG1); Free (TIG2); Free (TIG4);    Free (TIG8); Free (ROW1); Free (ROW2); Free (ROW4);    Free (ROW8); Scores (Rect (8, 8, W-7, H-7)). CopyTo (matchcost1f);}

  

vii. Debugging Information *.exe cannot be found or does not match (C + + cannot debug workaround)

You can skip it, it doesn't feel right.

Open property Page

    1. Program database for Edit and Continue (/zi), debug Information format, general
    2. Disabled (/od) for optimization
    3. Debugging information, debug, linker----yes (/debug)
Eight. Program Run

We can finally run the program.

    1. Unzip the downloaded VOC data set and place it somewhere, EG:D:\VOC
    2. Open the Runobjectness method in the Main.cpp file Datasetvoc voc2007 ("d:/voc/");
    3. Ctrl+f5, finally appeared the black box, has the wood to be very excited

Ps: My computer is older, sometimes it will crash, reboot, OK. 囧

    1. Put the last line of the program Objness.illutestreults (boxestests), note go, under voc2007/local/can see the results of the Picture Prediction target window

The effect is still good, the accuracy has not how to do analysis, the program run, after the voc2007/results/generated a perimgall.m file, directly in MATLAB can run out the results

The accuracy curve above is called dr-#WIN curves, a paper from Tpami 2012: Measuring the objectness of image windows. The original text also proposed that the number of windows, such as [[0,5000] normalized to [0,1], with the area under the curve as the target detection of the measurement results, and called the areas under the curve (AUC), so that the scope of the AUC is between [0,1].

CVPR2014 objectness Source conversion (full version) VS2012 X64–>win32

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.