DPM algorithm source program VOC-RELEASE5 configuration modification process in Windows

Source: Internet
Author: User

A recent "Video Processing and Analysis" course has a big job, which is about the DPM object detection algorithm. There is DPM source code, but the original can only be run on Linux or Mac, and my computer is Windows system, so I searched the internet on how Windows is running, finally through some code changes, you can run on Windows, the following record my modification process.

DPM source program Download: discriminatively trained deformable part Models (Release 5)

I downloaded the voc-release5 version.

voc-release5The original does not support compiling in a Windows system, but it can be solved with the following code modifications.

Source code Modification steps

1. Modify the features features.cc files in the directory: Add the #include following two lines of code below all (because the definition is missing on the Windows system);

  
 
  1. #define bzero(a, b) memset(a, 0, b)
  2. intround(floata) { floattmp=a- (int)a; if(tmp>= 0.5 ) return (int)a+ 1; Else return (int)a; }

2. Modify the features file in the directory resize.cc : Add the above two lines of code, and then the 39th line

 
   
  
  1. alphainfo ofs[len];

Switch

 
   
  
  1. struct alphainfo *ofs = (struct alphainfo *)malloc(sizeof(struct alphainfo)*len);

Add a row after line 80th (the function ends)

 
   
  
  1. free(ofs);

3. Modify the fv_cache file in the directory fv_compile.m : Comment out the 13th to 15th line of code (that is, allow compilation on the Windows system);

4. Modify the gdetect bounded_dt.cc files in the directory: Add the #include following two lines of code below all (also because the definition is missing on Windows systems);

 
   
  
  1. #define int32_t int
  2. #define INFINITY 1e8

5. Modify the gdetect dt.cc files in the directory: Add the #include following line of code below all (also because the definition is missing on Windows systems);

 
   
  
  1. #define int32_t int

6. Modify the star-cascade cascade.cc files in the directory: Add the #include following line of code below all (also because the definition is missing on Windows systems);

 
   
  
  1. #define INFINITY 1e8

7. Modify the star-cascade file in the directory cascade_compile.m : Comment out the 13th to 15th line of code (that is, allow compilation on the Windows system);

8. Modify the star-cascade file in the directory timer.h : delete the 6th line of code #include <sys/time.h> (because this is a Linux system header file, not in the Windows system), add the following lines of code (that is, add the missing header files and functions);

  
 
  1. #include <time.h>
  2. #include <windows.h>
  3. int gettimeofday(struct timeval *tp, void *tzp)
  4. {
  5. time_t clock;
  6. struct tm tm;
  7. SYSTEMTIME wtm;
  8. GetLocalTime(&wtm);
  9. tm.tm_year = wtm.wYear - 1900;
  10. tm.tm_mon = wtm.wMonth - 1;
  11. tm.tm_mday = wtm.wDay;
  12. tm.tm_hour = wtm.wHour;
  13. tm.tm_min = wtm.wMinute;
  14. tm.tm_sec = wtm.wSecond;
  15. tm. tm_isdst = -1;
  16. clock = mktime(&tm);
  17. tp->tv_sec = clock;
  18. tp->tv_usec = wtm.wMilliseconds * 1000;
  19. return (0);
  20. }

9. Modify the compile.m file: Comment out the 13th to 15th line of code (that is, allow compilation on the Windows system), comment out the 64th line and uncomment the 68th line (that is, choose compile fconv_var_dim.cc instead fconvsse.cc ). Comment out line 72nd and uncomment line 74th (that is, choose compile fconv_var_dim.cc instead fconv_var_dim_MT.cc ), then change all to -o -output ;

After the above steps have been modified, run in MATLAB demo.m (if your MATLAB has not yet configured MEX, you need to configure it in advance, that is, in the MATLAB command Window mex -setup , select a compiler Can).

Reference

DPM target Recognition under Windows configuration _moran_ Sina Blog
Linux under Gettimeofday function Windows replacement scheme _castleinthesky_ Sina Blog
What does "O" mean in mex-o in MATLAB and why it is wrong? _ Baidu Know
Using Pthread.h header files under VS2008 and VC6.0 | Toddler Garden
Run felzenszwalb under Windows Star-cascade DPM (deformable part Models) target detection matlab Source-Push Cool
Unknown features in GNU C:attribute__ mechanism-JuanA1 's column-blog channel-csdn.net
GCC __attribute
((packed)) | | attribute ((Aligned (4))) 2-green's Column-Blog channel-csdn.net
C-Language byte alignment (for example, 32-bit system) _ Kevin _ Sina Blog



From for notes (Wiz)

DPM algorithm source program VOC-RELEASE5 configuration modification process in Windows

Related Article

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.