Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'v1' of github.com:quantombone/exemplarsvm

  • Loading branch information...
commit 46069c26238b6d7e4e4dd7f1c595d0fe781304f3 2 parents 1acc55a + 1390b9d
@quantombone authored
Showing with 2,616 additions and 10,382 deletions.
  1. +0 −1  .gitignore
  2. +20 −0 COPYING
  3. +182 −27 README.md
  4. +2 −1  VOCcode/VOCevaldet.m
  5. +0 −215 apply_all_exemplars.m
  6. +0 −13 debug_demos/README.md
  7. +0 −23 debug_demos/count_windows.m
  8. +0 −48 debug_demos/demo_datasets.m
  9. +0 −94 debug_demos/demo_nonlinear.m
  10. +0 −52 debug_demos/demo_random_svms.m
  11. +0 −17 debug_demos/test_times.m
  12. +0 −66 demos/README.md
  13. +0 −50 demos/get_voc_dataset.m
  14. +0 −8 demos/load_data_directory.m
  15. +0 −111 demos/old.demos/draw_memex.m
  16. +0 −49 demos/old.demos/dump_memex_icons.m
  17. +0 −89 demos/old.demos/plot_size2_plot.m
  18. +0 −119 demos/old.demos/plot_size3_plot.m
  19. +0 −114 demos/old.demos/plot_size_plot.m
  20. +0 −276 demos/old.demos/plot_voc_results.m
  21. +0 −253 demos/old.demos/plot_voc_results3.m
  22. +0 −293 demos/old.demos/plot_voc_results_horiz.m
  23. +0 −112 demos/old.demos/video_scene.m
  24. +0 −155 demos/old.demos/voc_demo_dfun.m
  25. +0 −157 demos/old.demos/voc_demo_dumpfigs.m
  26. +0 −158 demos/old.demos/voc_demo_esvm_1000neg.m
  27. +0 −142 demos/old.demos/voc_demo_esvm_2010.m
  28. +0 −146 demos/old.demos/voc_demo_esvm_2010_full.m
  29. +0 −165 demos/old.demos/voc_demo_esvm_250neg.m
  30. +0 −169 demos/old.demos/voc_demo_esvm_25neg.m
  31. +0 −164 demos/old.demos/voc_demo_esvm_icons.m
  32. +0 −165 demos/old.demos/voc_demo_esvm_large.m
  33. +0 −166 demos/old.demos/voc_demo_esvm_small.m
  34. +0 −165 demos/old.demos/voc_demo_esvm_tiny.m
  35. +0 −150 demos/old.demos/voc_demo_nn.m
  36. +0 −148 demos/old.demos/voc_demo_nn2.m
  37. +0 −151 demos/old.demos/voc_demo_nocat.m
  38. +0 −142 demos/old.demos/voc_demo_segall.m
  39. +0 −168 demos/old.demos/voc_demo_svs.m
  40. +0 −169 demos/old.demos/voc_demo_tophits.m
  41. +0 −147 demos/old.demos/voc_memex.m
  42. +0 −259 demos/old.demos/voc_template_dumpfigs.m
  43. +0 −256 demos/old.demos/voc_template_memex.m
  44. +0 −263 demos/old.demos/voc_template_tophits.m
  45. +0 −125 demos/voc_demo_esvm.m
  46. +0 −298 demos/voc_template.m
  47. +0 −173 do_svm.m
  48. +69 −46 iccv11/pool_exemplar_detections.m → esvm_apply_calibration.m
  49. +95 −0 esvm_demo_apply_exemplars.m
  50. +148 −0 esvm_demo_train_fast.m
  51. +122 −142 localizemeHOG.m → esvm_detect.m
  52. +255 −0 esvm_detect_imageset.m
  53. +14 −0 esvm_download_models.m
  54. +81 −56 get_default_mining_params.m → esvm_get_default_params.m
  55. +73 −21 exemplar_initialize.m → esvm_initialize_exemplars.m
  56. +28 −0 esvm_perform_calibration.m
  57. +12 −0 esvm_quick_demo.m
  58. +109 −0 esvm_script_train_voc_class.m
  59. +74 −36 iccv11/show_top_dets.m → esvm_show_top_dets.m
  60. +14 −14 iccv11/show_hits_figure_iccv.m → esvm_show_transfer_figure.m
  61. +21 −0 esvm_subset_of_models.m
  62. +241 −0 esvm_train_exemplars.m
  63. +7 −0 esvm_update_voc_models.m
  64. +1 −1  features/HOGpicture.m
  65. +1 −1  features/README.md
  66. +0 −11 features/compile.m
  67. BIN  features/fconvblas.mexmaci64
  68. +18 −12 features/featpyramid2.m
  69. +18 −0 features/features_compile.m
  70. BIN  features/features_pedro.mexmaci64
  71. BIN  features/features_raw.mexmaci64
  72. +7 −11 features/resize.cc
  73. BIN  features/resize.mexmaci64
  74. +0 −119 followup/demo_regtrain.m
  75. +0 −178 followup/demo_vreg.m
  76. +0 −295 followup/demo_vreg2.m
  77. +0 −92 followup/kp_graph.m
  78. +0 −5 get_default_mining_params_scene.m
  79. +0 −40 get_dominant_basis.m
  80. +0 −97 get_pascal_stream.m
  81. +0 −3  gps/README.md
  82. BIN  gps/all_gps.mat
  83. +0 −6 gps/apply_james.m
  84. +0 −16 gps/apply_sketches.m
  85. +0 −36 gps/cart2gps.m
  86. +0 −47 gps/generate_gps_maps.m
  87. +0 −16 gps/get_gps_ball.m
  88. +0 −15 gps/get_james_160matches.m
  89. +0 −20 gps/get_james_bg.m
  90. +0 −73 gps/get_james_nearest.m
  91. +0 −51 gps/gps2cart.m
  92. +0 −176 gps/initialize_james_exemplars.m
  93. +0 −12 gps/james_name.m
  94. +0 −25 gps/kml_add_overlay.m
  95. +0 −13 gps/kml_add_placemark.m
  96. +0 −81 gps/kml_density_image.m
  97. +0 −87 gps/kml_distribution.m
  98. +0 −11 gps/load_james_image.m
  99. +0 −7 gps/loop_james_show.m
  100. +0 −64 gps/precompute_james_nearest.m
  101. +0 −92 gps/show_compare_james.m
  102. +0 −39 gps/show_james.m
  103. +0 −20 iccv11/apply_boost_M.m
  104. +0 −22 iccv11/calibrate_and_estimate_M.m
  105. +0 −29 iccv11/extract_bbs_from_rs.m
  106. +0 −41 iccv11/find_set_membership.m
  107. +0 −16 iccv11/initialize_mining_queue.m
  108. +0 −66 iccv11/old.initialize_model_dt.m
  109. +0 −25 iccv11/old.load_default_class.m
  110. +0 −8 iccv11/old.save_default_class.m
  111. +0 −46 iccv11/old.slow_nms.m
  112. BIN  images/demo_framing.pdf
  113. BIN  images/sa_teaser.png
  114. 0  {iccv11 → internal}/README.md
  115. 0  {iccv11 → internal}/calibrate_boxes.m
  116. +10 −5 iccv11/adjust_boxes.m → internal/esvm_adjust_boxes.m
  117. +28 −0 internal/esvm_apply_M.m
  118. +60 −50 iccv11/estimate_M.m → internal/esvm_estimate_M.m
  119. +5 −0 internal/esvm_get_default_params_scene.m
  120. +108 −0 internal/esvm_get_pascal_stream.m
  121. +4 −3 initialize_fixedframe_model.m → internal/esvm_initialize_fixedframe_exemplar.m
  122. +10 −10 initialize_goalsize_model.m → internal/esvm_initialize_goalsize_exemplar.m
  123. +21 −0 internal/esvm_initialize_mining_queue.m
  124. +38 −35 load_all_models.m → internal/esvm_load_models.m
  125. +37 −17 load_result_grid.m → internal/esvm_load_result_grid.m
  126. +14 −14 mine_negatives.m → internal/esvm_mine_negatives.m
  127. +20 −46 mine_train_iteration.m → internal/esvm_mine_train_iteration.m
  128. +24 −26 iccv11/perform_calibration.m → internal/esvm_perform_platt_calibration.m
  129. +14 −24 do_dfun.m → internal/esvm_update_dfun.m
  130. +166 −0 internal/esvm_update_svm.m
  131. +41 −34 {iccv11 → internal}/evaluate_pascal_voc_grid.m
  132. 0  { → internal}/exemplar_initialize_dt.m
  133. +7 −3 {iccv11 → internal}/exemplar_inpaint.m
  134. 0  {iccv11 → internal/experiments}/complem_experiment.m
  135. 0  {iccv11 → internal/experiments}/cook_abhinav_transfers.m
  136. 0  {iccv11 → internal/experiments}/count_correct_person.m
  137. +1 −0  {iccv11 → internal/experiments}/do_pedro_transfer.m
  138. +1 −1  {iccv11 → internal/experiments}/evaluate_pascal_voc_grid_complements.m
  139. 0  {iccv11 → internal/experiments}/generate_figures.m
  140. 0  {iccv11 → internal/experiments}/generate_supp_mat_tex.m
  141. 0  {iccv11 → internal/experiments}/geom_eval.m
  142. 0  {iccv11 → internal/experiments}/label_buses.m
  143. 0  {iccv11 → internal/experiments}/show_context_hits.m
  144. 0  {iccv11 → internal/experiments}/stats_on_person.m
  145. 0  {iccv11 → internal/experiments}/supplemental.tex
  146. 0  {iccv11 → internal/experiments}/test_all_complements.m
  147. 0  {iccv11 → internal}/extract_svs.m
  148. 0  {iccv11 → internal}/faces2colors.m
  149. 0  {iccv11 → internal}/flip_box.m
  150. 0  {iccv11 → internal}/flip_faces.m
  151. 0  {iccv11 → internal}/flip_image.m
  152. 0  { → internal}/generate_docs.m
  153. 0  {iccv11 → internal}/get_box_features.m
  154. +16 −8 {iccv11 → internal}/get_exemplar_icon.m
  155. 0  {iccv11 → internal}/get_file_id.m
  156. +1 −1  {iccv11 → internal}/get_geometry_icon.m
  157. 0  { → internal}/get_pascal_anno_function.m
  158. +17 −5 {iccv11 → internal}/get_pascal_set.m
  159. 0  {iccv11 → internal}/get_seg_icon.m
  160. 0  {iccv11 → internal}/get_sv_row.m
  161. +25 −10 {iccv11 → internal}/get_sv_stack.m
  162. +44 −0 internal/get_voc_dataset.m
  163. 0  {iccv11 → internal}/learn_sigmoid.m
  164. 0  {iccv11 → internal}/mywarppos.m
  165. 0  {iccv11 → internal}/nms.m
  166. 0  {iccv11 → internal}/nms_within_exemplars.m
  167. +1 −1  {iccv11 → internal}/perform_hitdump.m
  168. 0  {iccv11 → internal}/populate_wiggles.m
  169. 0  {iccv11 → internal}/prune_grid.m
  170. 0  {iccv11 → internal}/replica_hits.m
  171. 0  {iccv11 → internal}/showM.m
  172. 0  {iccv11 → internal}/show_hits_figure.m
  173. +18 −0 internal/show_top_match_image.m
  174. 0  {iccv11 → internal}/show_top_transfers.m
  175. +1 −1  iccv11/strip_model.m → internal/strip_models.m
  176. +5 −4 {iccv11 → internal}/transfer_friends.m
  177. BIN  libsvm-mat-3.0-1/libsvmread.mexa64
  178. BIN  libsvm-mat-3.0-1/libsvmread.mexmaci
  179. BIN  libsvm-mat-3.0-1/libsvmread.mexmaci64
  180. BIN  libsvm-mat-3.0-1/libsvmread.mexw32
  181. BIN  libsvm-mat-3.0-1/libsvmwrite.mexa64
  182. BIN  libsvm-mat-3.0-1/libsvmwrite.mexmaci
  183. BIN  libsvm-mat-3.0-1/libsvmwrite.mexmaci64
  184. BIN  libsvm-mat-3.0-1/libsvmwrite.mexw32
  185. +0 −10 libsvm-mat-3.0-1/make.m
  186. BIN  libsvm-mat-3.0-1/svmpredict.mexa64
  187. BIN  libsvm-mat-3.0-1/svmpredict.mexmaci
  188. BIN  libsvm-mat-3.0-1/svmpredict.mexw32
  189. 0  {libsvm-mat-3.0-1 → libsvm}/.gitignore
  190. 0  {libsvm-mat-3.0-1 → libsvm}/COPYRIGHT
  191. 0  {libsvm-mat-3.0-1 → libsvm}/Makefile
  192. 0  {libsvm-mat-3.0-1 → libsvm}/README
  193. +10 −0 libsvm/libsvm_compile.m
  194. 0  libsvm-mat-3.0-1/svmpredict.c → libsvm/libsvmpredict.c
  195. 0  {libsvm-mat-3.0-1 → libsvm}/libsvmread.c
  196. 0  {libsvm-mat-3.0-1 → libsvm}/libsvmtrain.c
  197. 0  {libsvm-mat-3.0-1 → libsvm}/libsvmtrain.mexa64
  198. 0  {libsvm-mat-3.0-1 → libsvm}/libsvmtrain.mexmaci
  199. 0  {libsvm-mat-3.0-1 → libsvm}/libsvmtrain.mexmaci64
  200. 0  {libsvm-mat-3.0-1 → libsvm}/libsvmwrite.c
  201. 0  {libsvm-mat-3.0-1 → libsvm}/svm.cpp
  202. 0  {libsvm-mat-3.0-1 → libsvm}/svm.h
  203. 0  {libsvm-mat-3.0-1 → libsvm}/svm_model_matlab.c
  204. 0  {libsvm-mat-3.0-1 → libsvm}/svm_model_matlab.h
  205. +0 −126 load_voc_models.m
  206. +0 −9 memex_browser/README.md
  207. +0 −144 memex_browser/memex.js
  208. +0 −7 memex_browser/raphael.js
  209. +0 −224 memex_browser/show_exemplar_browser.m
  210. +0 −121 memex_browser/show_memex_browser2.m
  211. 0  debug_demos/demo_framing.m → old.demo_framing.m
  212. +161 −0 old.demo_interact.m
  213. +0 −185 train_all_exemplars.m
  214. +15 −0 util/check_for_lock_files.m
  215. 0  util/{ → display}/jettify.m
  216. 0  util/{ → display}/plot_bbox.m
  217. 0  util/{ → display}/plot_faces.m
  218. 0  { → util/display}/show_exemplar_frames.m
  219. 0  util/{ → display}/tight_subplot.m
  220. +2 −0  util/util_compile.m
  221. +0 −33 video/ScreenCapture.m
  222. +44 −231 video/capture_screen.m
  223. +2 −2 video/get_movie_bg.m
  224. +19 −15 video/get_screenshot_bg.m
  225. +8 −11 video/initialize_screenshot.m
  226. +6 −6 video/select_bbox_from_image.m
  227. +0 −388 video/video_exemplar_initialize.m
View
1  .gitignore
@@ -1,4 +1,3 @@
-*.mat
*~
.DS_Store
data/
View
20 COPYING
@@ -0,0 +1,20 @@
+Copyright (C) 2011-12 by Tomasz Malisiewicz
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
View
209 README.md
@@ -1,47 +1,202 @@
-### ICCV2011 Abstract
+Welcome to the Exemplar-SVM library, a large-scale object recognition
+library developed at Carnegie Mellon University while obtaining my PhD
+in Robotics.
+ -- Tomasz Malisiewicz
-This paper proposes a conceptually simple but surprisingly powerful method which combines the effectiveness of a discriminative object detector with the explicit correspondence offered by a nearest-neighbor approach. The method is based on training a separate linear SVM classifier for every exemplar in the training set. Each of these Exemplar-SVMs is thus defined by a single positive instance and millions of negatives. While each detector is quite specific to its exemplar, we empirically observe that an ensemble of such Exemplar-SVMs offers surprisingly good generalization. Our performance on the PASCAL VOC detection task is on par with the much more complex latent part-based model of Felzenszwalb et al., at only a modest computational cost increase. But the central benefit of our approach is that it creates an explicit association between each detection and a single training exemplar. Because most detections show good alignment to their associated exemplar, it is possible to transfer any available exemplar meta-data (segmentation, geometric structure, 3D model, etc.) directly onto the detections, which can then be used as part of overall scene understanding.
+The code is written in Matlab and is the basis of the following two
+projects:
+
+## [Tomasz Malisiewicz](http://www.cs.cmu.edu/~tmalisie/), [Abhinav Gupta](http://www.cs.cmu.edu/~abhinavg), [Alexei A. Efros](http://www.cs.cmu.edu/~efros). **Ensemble of Exemplar-SVMs for Object Detection and Beyond.** In ICCV, 2011. [PDF](http://www.cs.cmu.edu/~tmalisie/projects/iccv11/exemplarsvm-iccv11.pdf) | [Project Page](http://www.cs.cmu.edu/~tmalisie/projects/iccv11/)
![](https://github.com/quantombone/exemplarsvm/raw/master/images/exemplar_classifiers-small_n.png)
-----
-**Author + Executive Exemplar-SVM Developer**: [Tomasz Malisiewicz](http://www.cs.cmu.edu/~tmalisie/)
-<br/>
-**Exemplar-SVM Fellow Developer**: [Abhinav Shrivastava](http://www.abhinav-shrivastava.info/)
-<br/>
-**Exemplar-SVM Visionary**: [Abhinav Gupta](http://www.cs.cmu.edu/~abhinavg)
-<br/>
-**Exemplar-SVM Visionary**: [Alexei A. Efros](http://www.cs.cmu.edu/~efros)
-###Please cite the following paper if you use this library:
+Abstract
+
+This paper proposes a conceptually simple but surprisingly powerful method which combines the effectiveness of a discriminative object detector with the explicit correspondence offered by a nearest-neighbor approach. The method is based on training a separate linear SVM classifier for every exemplar in the training set. Each of these Exemplar-SVMs is thus defined by a single positive instance and millions of negatives. While each detector is quite specific to its exemplar, we empirically observe that an ensemble of such Exemplar-SVMs offers surprisingly good generalization. Our performance on the PASCAL VOC detection task is on par with the much more complex latent part-based model of Felzenszwalb et al., at only a modest computational cost increase. But the central benefit of our approach is that it creates an explicit association between each detection and a single training exemplar. Because most detections show good alignment to their associated exemplar, it is possible to transfer any available exemplar meta-data (segmentation, geometric structure, 3D model, etc.) directly onto the detections, which can then be used as part of overall scene understanding.
+
+---
-Tomasz Malisiewicz, Abhinav Gupta, Alexei A. Efros. **Ensemble of Exemplar-SVMs for Object Detection and Beyond.** In ICCV, 2011.
-[PDF](http://www.cs.cmu.edu/~tmalisie/projects/iccv11/exemplarsvm-iccv11.pdf)
-[Project Page](http://www.cs.cmu.edu/~tmalisie/projects/iccv11/)
+## [Abhinav Shrivastava](http://www.abhinav-shrivastava.info/), [Tomasz Malisiewicz](http://www.cs.cmu.edu/~tmalisie/), [Abhinav Gupta](http://www.cs.cmu.edu/~abhinavg), [Alexei A. Efros](http://www.cs.cmu.edu/~efros). **Data-driven Visual Similarity for Cross-domain Image Matching.** In SIGGRAPH ASIA, December 2011. [PDF](http://www.cs.cmu.edu/~tmalisie/projects/sa11/shrivastava-sa11.pdf) | [Project Page](http://graphics.cs.cmu.edu/projects/crossDomainMatching/)
-###See my PhD thesis for more information and ICCV follow-up experiments:
+![](https://github.com/quantombone/exemplarsvm/raw/v1/images/sa_teaser.png)
-Tomasz Malisiewicz. **Exemplar-based Representations for Object Detection, Association and Beyond.** PhD Dissertation, tech. report CMU-RI-TR-11-32. August, 2011. [PDF](http://www.cs.cmu.edu/~tmalisie/thesis/malisiewicz_thesis.pdf)
+Abstract
-###See our SIGGRAPH ASIA 2011 paper for image on image matching:
-Abhinav Shrivastava, Tomasz Malisiewicz, Abhinav Gupta, Alexei A. Efros. **Data-driven Visual Similarity for Cross-domain Image Matching.** In SIGGRAPH ASIA, December 2011. [PDF](http://www.cs.cmu.edu/~tmalisie/projects/sa11/shrivastava-sa11.pdf) [Project Page](http://graphics.cs.cmu.edu/projects/crossDomainMatching/)
+The goal of this work is to find visually similar images even if they
+appear quite different at the raw pixel level. This task is
+particularly important for matching images across visual domains, such
+as photos taken over different seasons or lighting conditions,
+paintings, hand-drawn sketches, etc. We propose a surprisingly simple
+method that estimates the relative importance of different features in
+a query image based on the notion of "data-driven uniqueness". We
+employ standard tools from discriminative object detection in a novel
+way, yielding a generic approach that does not depend on a particular
+image representation or a specific visual domain. Our approach shows
+good performance on a number of difficult cross-domain visual tasks
+e.g., matching paintings or sketches to real photographs. The method
+also allows us to demonstrate novel applications such as Internet
+re-photography, and painting2gps.
-----
-This object recognition library uses some great software:
+---
-* [libsvm-3.0-1](http://www.csie.ntu.edu.tw/~cjlin/libsvm/)
+More details and experimental evaluation can be found in my PhD thesis, available to download as a PDF.
-* fast blas convolution code (from [voc-release-4.0](http://www.cs.brown.edu/~pff/latent/)),
+[Tomasz Malisiewicz](http://www.cs.cmu.edu/~tmalisie/). **Exemplar-based Representations for Object Detection, Association and Beyond.** PhD Dissertation, tech. report CMU-RI-TR-11-32. August, 2011. [PDF](http://www.cs.cmu.edu/~tmalisie/thesis/malisiewicz_thesis.pdf)
-* 31-D HOG feature code (from [voc-release-3.1](http://www.cs.brown.edu/~pff/latent/)),
+----
+
+This object recognition library uses some great open-source software:
+
+* Linear SVM training: [libsvm-3.0-1](http://www.csie.ntu.edu.tw/~cjlin/libsvm/)
+
+* Fast blas convolution code (from [voc-release-4.0](http://www.cs.brown.edu/~pff/latent/)),
+
+* HOG feature code (31-D) (from [voc-release-3.1](http://www.cs.brown.edu/~pff/latent/)),
* [VOC development/evaluation code](http://pascallin.ecs.soton.ac.uk/challenges/VOC/) imported from the PASCAL VOC website
+
+----
+
+# MATLAB Quick Start Guide
+
+To get started, you need to install MATLAB and download the code from Github. This code has been tested on Mac OS X and Linux. Pre-compiled Mex files for Mac OS X and Linux are included.
+
+## Download Exemplar-SVM Library source code (MATLAB and C++)
+``` sh
+$ cd ~/projects/
+$ git clone git@github.com:quantombone/exemplarsvm.git
+$ cd ~/projects/exemplarsvm
+```
+
+## Make sure Exemplar-SVM library is compiled and working (You shouldn't have to do this on Mac OS X or Linux)
+``` sh
+$ matlab
+$ >> cd features/
+$ >> features_compile;
+$ >> cd ../util/
+$ >> util_compile;
+$ >> cd ../libsvm/
+$ >> libsvm_compile;
+```
+
+## Download and load pre-trained VOC2007 model(s)
+``` sh
+$ matlab
+$ addpath(genpath(pwd))
+$ >> esvm_download_models('bus');
+$ >> load voc2007-bus.mat #vars "models", "M" and URL-based "test_set" are loaded
+```
+
+You can alternatively download the pre-trained models individually from [http://people.csail.mit.edu/tomasz/exemplarsvm/models/](http://people.csail.mit.edu/tomasz/exemplarsvm/models/) or a tar file of all models [voc2007-models.tar](http://people.csail.mit.edu/tomasz/exemplarsvm/models/voc2007-models.tar) (NOTE: 449MB)
+
+``` sh
+$ cd ~/projects/exemplarsvm/
+$ wget http://people.csail.mit.edu/~tomasz/exemplarsvm/voc2007-models.tar
+$ tar -xf voc2007-models.tar
+```
+
+then in MATLAB, you can load models by their name:
+
+``` sh
+$ matlab
+$ >> load voc2007_bus.mat
+```
+
+
+## Apply models to a set of images (test_set)
+
+``` sh
+$ >> esvm_demo_apply_exemplars(test_set, models, M);
+```
+
+Or load your own image
+
+``` sh
+$ matlab
+$ >> I = imread('image1.png'); #load your own image
+$ >> esvm_demo_apply_exemplars(I, models, M);
+```
+
+Or load your own set of images
+
+``` sh
+$ matlab
+$ >> I1 = imread('image1.png'); #your own image
+$ >> ...
+$ >> IN = imread('imageN.png'); #your own image
+$ >> Iarray = {I1, ..., IN};
+$ >> esvm_demo_apply_exemplars(Iarray, models, M)
+```
+
+Or process a directory of images
+
+``` sh
+$ matlab
+$ >> Idirectory = '~/images/';
+$ >> esvm_demo_apply_exemplars(Idirectory, models, M)
+```
+
---
-## Quickstart Guide
- * For training your own exemplars, see the notes in [exemplarsvm/demos/README.md](https://github.com/quantombone/exemplarsvm/blob/master/demos/README.md) and the main training script in [exemplarsvm/demos/voc_demo_esvm.m](https://github.com/quantombone/exemplarsvm/blob/master/demos/voc_demo_esvm.m)
-
- * For evaluating the PASCAL VOC 2007 pre-trained exemplars, see the notes in [exemplarsvm/demos/README.md](https://github.com/quantombone/exemplarsvm/blob/master/demos/README.md) and the main evaluation function in [exemplarsvm/demos/voc_demo_apply.m](https://github.com/quantombone/exemplarsvm/blob/master/demos/voc_demo_apply.m)
+# Train and Test an Ensemble of Exemplar-SVMs from scratch
+
+
+The training scripts are designed to work with the PASCAL VOC 2007
+dataset, so we need to download that first.
+
+## Install PASCAL VOC 2007 trainval/test sets
+``` sh
+$ mkdir /nfs/baikal/tmalisie/pascal #Make a directory for the PASCAL VOC data
+$ cd /nfs/baikal/tmalisie/pascal
+$ wget http://pascallin.ecs.soton.ac.uk/challenges/VOC/voc2007/VOCtrainval_06-Nov-2007.tar
+$ wget http://pascallin.ecs.soton.ac.uk/challenges/VOC/voc2007/VOCtest_06-Nov-2007.tar
+$ tar xf VOCtest_06-Nov-2007.tar
+$ tar xf VOCtrainval_06-Nov-2007.tar
+```
+
+You can also get the VOC 2007 dataset tar files manually, [VOCtrainval_06-Nov-2007.tar](http://pascallin.ecs.soton.ac.uk/challenges/VOC/voc2007/VOCtrainval_06-Nov-2007.tar) and [VOCtest_06-Nov-2007.tar](http://pascallin.ecs.soton.ac.uk/challenges/VOC/voc2007/VOCtest_06-Nov-2007.tar)
+
+
+## Edit directories in esvm_script_train_voc_class.m
+``` sh
+data_directory = '/your/directory/to/pascal/VOCdevkit/';
+results_directory = '/your/results/directory/';
+```
+
+## Training and Evaluating an Ensemble of "bus" Exemplar-SVMs
+``` sh
+$ matlab
+$ addpath(genpath(pwd))
+$ >> [models,M] = esvm_script_train_voc_class('bus');
+# All output (models, M-matrix, AP curve) has been written to results_directory
+```
+
+# Extra: How to run the Exemplar-SVM framework on a cluster?
+
+This library was meant to run on a cluster with a shared NFS/AFS file
+structure where all nodes can read/write data from a common data
+source/target. The PASCAL VOC dataset must be installed on such a
+shared resource and the results directory as well. The idea is that
+results are written as .mat files and intermediate work is protected
+via lock files. Lock files are temporary files (they are directories
+actually) which are deleted once something has finished process. This
+means that the entire voc training script can be replicated across a
+cluster, you can run the script 200x times and the training will
+happen in parallel.
+
+To run ExemplarSVM on a cluster, first make sure you have a cluster,
+use an ssh-based launcher such as my
+[warp_scripts](https://github.com/quantombone/warp_scripts) github
+project. I have used warp_starter.sh at CMU (using WARP cluster)
+and sc.sh at MIT (using the continents).
+
+### Here is the command I often use at MIT to start Exemplar-SVM runs, where machine_list.sh contains computer names
+``` sh
+$ cd ~/warp_scripts/
+$ ./sc.sh "cd ~/projects/exemplarsvm; addpath(genpath(pwd)); esvm_script_train_voc_class('train');"
+```
+
---
**Copyright (C) 2011 by Tomasz Malisiewicz**
View
3  VOCcode/VOCevaldet.m
@@ -73,7 +73,7 @@
[ap, apold, rec, prec, fp, tp, is_correct] = get_aps(VOCopts,draw,cls,gtids,gt,npos,ids,confidence,BB);
finaltime = toc(sss);
-fprintf(1,'final time is %.3f\n',finaltime);
+fprintf(1,'Time for computing AP: %.3fsec\n',finaltime);
function [ap,apold,rec,prec,fp,tp,is_correct] = get_aps(VOCopts,draw,cls,gtids,gt,npos,ids,confidence,BB);
@@ -113,6 +113,7 @@
% assign detection to ground truth object if any
bb=BB(:,d);
ovmax=-inf;
+
for j=1:size(gt(i).BB,2)
bbgt=gt(i).BB(:,j);
bi=[max(bb(1),bbgt(1)) ; max(bb(2),bbgt(2)) ; min(bb(3),bbgt(3)) ; min(bb(4),bbgt(4))];
View
215 apply_all_exemplars.m
@@ -1,215 +0,0 @@
-function allfiles = apply_all_exemplars(dataset_params,models,fg,setname,M)
-% Apply a set of models (raw exemplars, trained exemplars, dalals,
-% poselets, components, etc) to a set of images. Script can be ran in
-% parallel with no arguments. After running script, use
-% grid=load_result_grid(models) to load results.
-%
-% models: Input cell array of models (try models=load_all_models)
-% M: The boosting Matrix (optional)
-% curset: The PASCAL VOC image set to apply the exemplars to
-% ('trainval' or 'test')
-%
-% Tomasz Malisiewicz (tomasz@cmu.edu)
-
-%Save results every NIMS_PER_CHUNK images
-
-if length(fg) == 0
- allfiles = {};
- return;
-end
-
-
-
-%Only allow display to be enabled on a machine with X
-display = dataset_params.display;
-
-if display == 1
- fprintf(1,'DISPLAY ENABLED, NOT SAVING RESULTS!\n');
- dataset_params.NIMS_PER_CHUNK = 1;
-end
-
-NIMS_PER_CHUNK = dataset_params.NIMS_PER_CHUNK;
-
-if ~isfield(dataset_params,'params')
- params = get_default_mining_params;
-else
- params = dataset_params.params;
-end
-
-%if strcmp(models{1}.models_name,'dalal')
-% params.TOPK = 100;
-% params.thresher = -2.5;
-%end
-
-setname = [setname '.' models{1}.cls];
-
-baser = sprintf('%s/applied/%s-%s/',dataset_params.localdir,setname, ...
- models{1}.models_name);
-
-if ~exist(baser,'dir')
- fprintf(1,'Making directory %s\n',baser);
- mkdir(baser);
-end
-
-%% Chunk the data into NIMS_PER_CHUNK images per chunk so that we
-%process several images, then write results for entire chunk
-
-inds = do_partition(1:length(fg),NIMS_PER_CHUNK);
-
-% randomize chunk orderings
-myRandomize;
-ordering = randperm(length(inds));
-if display == 1
- ordering = 1:length(ordering);
-end
-
-%[v,host_string]=unix('hostname');
-
-allfiles = cell(length(ordering), 1);
-
-for i = 1:length(ordering)
-
- ind1 = inds{ordering(i)}(1);
- ind2 = inds{ordering(i)}(end);
- filer = sprintf('%s/result_%05d-%05d.mat',baser,ind1,ind2);
- allfiles{i} = filer;
- filerlock = [filer '.lock'];
-
-
- if ~display && (fileexists(filer) || (mymkdir_dist(filerlock) == 0))
- continue
- end
-
-
- res = cell(0,1);
-
- %% pre-load all images in a chunk
- fprintf(1,'Preloading %d images\n',length(inds{ordering(i)}));
- clear Is;
- for j = 1:length(inds{ordering(i)})
- Is{j} = convert_to_I(fg{inds{ordering(i)}(j)});
- end
-
- for j = 1:length(inds{ordering(i)})
-
- index = inds{ordering(i)}(j);
- fprintf(1,' ---image %d\n',index);
- Iname = fg{index};
- %curid = -1;
- [tmp,curid,tmp] = fileparts(Iname);
-
- I = Is{j};
-
- starter = tic;
- [rs,t] = localizemeHOG(I, models, params);
-
- for q = 1:length(rs.bbs)
- if ~isempty(rs.bbs{q})
- rs.bbs{q}(:,11) = index;
- if length(rs.bbs{q}(1,:))~=12
- error('BUG: Invalid length bb');
- end
- end
- end
-
- coarse_boxes = cat(1,rs.bbs{:});
- if ~isempty(coarse_boxes)
- scores = coarse_boxes(:,end);
- else
- scores = [];
- end
- [aa,bb] = max(scores);
- fprintf(1,' took %.3fsec, maxhit=%.3f, #hits=%d\n',...
- toc(starter),aa,length(scores));
-
- % Transfer GT boxes from models onto the detection windows
- boxes = adjust_boxes(coarse_boxes,models);
-
- if (params.MIN_SCENE_OS > 0.0)
- os = getosmatrix_bb(boxes,[1 1 size(I,2) size(I,1)]);
- goods = find(os >= params.MIN_SCENE_OS);
- boxes = boxes(goods,:);
- coarse_boxes = coarse_boxes(goods,:);
- end
-
-
- if display == 1
- %extract detection box vectors from the localization results
- saveboxes = boxes;
- if size(boxes,1)>=1
- boxes(:,5) = 1:size(boxes,1);
- end
-
- if exist('M','var') && length(M)>0
- boxes = calibrate_boxes(boxes, M.betas);
- end
-
- if numel(boxes)>0
- [aa,bb] = sort(boxes(:,end),'descend');
- boxes = boxes(bb,:);
- end
-
- %already nmsed (but not for LRs)
- boxes = nms_within_exemplars(boxes,.5);
-
- size(boxes,1);
- %% ONLY SHOW TOP 5 detections or fewer
- %boxes = boxes(1:min(size(boxes,1),8),:);
-
-
-
- if 1% size(boxes,1) >=1
- figure(53)
- clf
- % stuff.filer = '';
- % exemplar_overlay = exemplar_inpaint(boxes(1,:), ...
- % models{boxes(1,6)}, ...
- % stuff);
-
- % show_hits_figure_iccv(models,boxes,I,I,exemplar_overlay,I);
-
- show_hits_figure(models, boxes, I);
- drawnow
- %pause(.1)
- else
- figure(1)
- clf
- imagesc(I)
- drawnow
- fprintf(1,'No detections in this Image\n');
- pause(.1)
- end
- boxes = saveboxes;
- end
-
- extras = [];
- res{j}.coarse_boxes = coarse_boxes;
- res{j}.bboxes = boxes;
-
- res{j}.index = index;
- res{j}.extras = extras;
- res{j}.imbb = [1 1 size(I,2) size(I,1)];
- res{j}.curid = curid;
-
- %%%NOTE: the gt-function is well-defined for VOC-exemplars
- if isfield(params,'gt_function') && ~isempty(params.gt_function)
- res{j}.extras = params.gt_function(dataset_params, Iname, res{j}.bboxes);
- end
- end
-
- if display == 1
- continue
- end
-
-
- % save results into file and remove lock file
- save(filer,'res');
- try
- rmdir(filerlock);
- catch
- fprintf(1,'Directory %s already gone\n',filerlock);
- end
-
-end
-
-[allfiles,bb] = sort(allfiles);
View
13 debug_demos/README.md
@@ -1,13 +0,0 @@
-ExemplarSVM debug demos
-
-Author: Tomasz Malisiewicz (tomasz@cmu.edu)
-
-This directory contains some debug demos which I used while building the Exemplar-SVM framework.
-They produce pretty pictures, you should have fun with them.
-
-To run the framing debugging demo, in Matlab run:
-
- publish('demo_framing','pdf')
-
-This will generate the resulting pdf:
-https://github.com/quantombone/exemplarsvm/raw/master/pdfs/demo_framing.pdf
View
23 debug_demos/count_windows.m
@@ -1,23 +0,0 @@
-function count_windows
-%%Here we count how many windows there are in a slide!!!
-
-bg = get_pascal_bg('trainval');
-I = convert_to_I(bg{1});
-sbin = 8;
-lpo = 10;
-padder = 10;
-
-%hg_size = [20 20];
-p = featpyramid2(I,sbin,lpo);
-p = cellfun2(@(x)padarray(x,[2 2 0]),p);
-p = cellfun2(@(x)[size(x,1) size(x,2)],p);
-
-for r = 1:20
- hg_size = [r r];
- p2 = cellfun2(@(x)max(0.0,x-hg_size),p);
- p2 = cellfun(@(x)prod(x),p2);
- nwin(r) = sum(p2);
-end
-
-
-keyboard
View
48 debug_demos/demo_datasets.m
@@ -1,48 +0,0 @@
-%Here is a data-set demo
-%A. James Hays' 6.5million geotagged Flickr images
-
-%Get gps coordinates from wikipedia search
-%landmark_gps = [48.853033; 2.34969]; %notre dame
-landmark_name = 'Golden Gate';
-landmark_gps = [37.819722; -122.478611]; %golden gate
-
-%Load gps coordinates of all 6.5 million images
-load all_gps.mat
-
-%Get distances between gps of all images to to landmark gps
-distances = get_gps_ball(gps,landmark_gps);
-
-%Take top 1000 closest images to landmark
-[aa,bb] = sort(distances);
-subset = bb(1:1000);
-fprintf(1,'Total of %d images within %.3fkm of %s\n',...
- 1000,aa(1000),landmark_name);
-
-%Create an image set datastructure
-fg = get_james_bg(100,subset);
-
-%create a set of 1000 "far away" images
-bg = get_james_bg(1000,bb(10000:end));
-
-%show images
-figure(1)
-clf
-N = 5;
-for i = 1:N*N
- subplot(N,N,i)
- imagesc(convert_to_I(fg{i}))
- axis image
- axis off
- title(sprintf('Distances = %.3fkm\n',aa(i)))
-end
-
-return;
-%%get exemplar from image 11 (which is of notre dame facade)
-initialize_exemplars_fg(fg(11));
-
-%%learn stuff
-update_models_fg;
-
-%%
-models = load_all_exemplars;
-
View
94 debug_demos/demo_nonlinear.m
@@ -1,94 +0,0 @@
-function demo_nonlinear
-%% try a nonlinear decision boundary
-
-xs = linspace(0,4*pi,1000);
-xs2 = sin(xs);
-
-PAD = 1;
-xpos = [xs; xs2 + PAD + randn(size(xs))];
-xneg = [xs; xs2 - PAD + randn(size(xs))];
-
-ypos = xs*0 + 1;
-yneg = xs*0 - 1;
-
-x = [xpos xneg];
-y = [ypos yneg];
-
-pos = find(y==1);
-neg = find(y==-1);
-
-%figure(1)
-%clf
-%subplot(1,2,1)
-
-y = y';
-
-for iii = -1:1:5
-
-SVMC = 10^(-3+iii);
-%SVMC = 10;
-%gamma = 10^(-2+iii);
-gamma = .001;
-
-
-
-%tic
-svm_model = libsvmtrain(y, x',sprintf(['-s 0 -t 2 -c' ...
- ' %f -gamma %f -q'],SVMC,gamma));
-%toc
-
-%tic
-[predicted_label, accuracy] = libsvmpredict(y, x', svm_model);
-%toc
-
-
-
-min1 = min(x,[],2);
-max1 = max(x,[],2);
-ranges = range(x,2);
-min1 = min1 - .2*ranges;
-max1 = max1 + .2*ranges;
-
-
-NCUTS = 100;
-[xxx,yyy] = meshgrid(linspace(min1(1),max1(1),NCUTS),...
- linspace(min1(2),max1(2),NCUTS));
-
-newvals = [xxx(:)'; yyy(:)'];
-%tic
-%[predicted_label, accuracy] = svmpredict(zeros(size(newvals,2),1), newvals', svm_model);
-%toc
-
-
-
-%tic
-myscores = mysvmpredict(newvals,svm_model);
-%toc
-predicted_label = sign(myscores);
-
-
-
-pos2 = find(predicted_label == 1);
-neg2 = find(predicted_label == -1);
-
-%subplot(1,2,2)
-figure(1)
-clf
-subplot(1,2,1)
-plot(newvals(1,pos2),newvals(2,pos2),'r.','MarkerSize',30)
-hold on;
-plot(newvals(1,neg2),newvals(2,neg2),'b.','MarkerSize',30)
-hold on;
-plot(x(1,pos),x(2,pos),'g.')
-hold on
-plot(x(1,neg),x(2,neg),'m.')
-title(sprintf('Boundary SVMC=%f gamma=%f',SVMC,gamma))
-
-subplot(1,2,2)
-imagesc(reshape(myscores,NCUTS,NCUTS))
-title(sprintf('#SV = %d',length(svm_model.sv_coef)))
-drawnow
-
-end
-
-
View
52 debug_demos/demo_random_svms.m
@@ -1,52 +0,0 @@
-function demo_random_svms
-%% Here is a simple test where we generate N datapoints in a space
-%% of D dimensions, and we try to train a classifier using a linear
-%% SVM when assigning classes RANDOMLY to the datapoints
-
-%% The take-home lesson is that if N<<D, then we can always create
-%% a perfect separation between the positives and negatives
-
-%% Tomasz Malisiewicz
-
-D = 100;
-N = 100;
-superx = randn(D,N);
-supery = double(rand(N,1)>.9);
-supery(1) = 1;
-supery(supery==0) = -1;
-[supery,ind] = sort(supery,'descend');
-superx = superx(:,ind);
-
-if 0
-svm_model = svmtrain(supery,superx','-s 0 -t 0 -c .01 -q');
-svm_weights = full(sum(svm_model.SVs .* ...
- repmat(svm_model.sv_coef,1,size(svm_model.SVs,2)),1));
-wex = svm_weights';
-b = svm_model.rho;
-end
-
-%% try liblinear now
-%model2 = liblinear_train(supery, sparse(superx)', ['-s 2 -B 1 -c' ...
-% ' .1'])
-
-[w,b,obj] = primal_svm_pos(supery,1/.1,superx');
-b = -b;
-
-model = liblinear_train(supery, sparse(superx)', '-s 2 -B 1 -c .1')
-w2 = model.w(1:end-1)';
-b2 = model.w(end);
-
-figure(4)
-plot(w,w2,'r.')
-
-y2 = w'*superx - b;
-figure(1)
-clf
-pos = find(supery==1);
-neg = find(supery==-1);
-plot(1+randn(length(pos))*.01,y2(pos),'r.');
-hold on;
-plot(-1+randn(length(neg))*.01,y2(neg),'g.');
-xlabel('Class')
-ylabel('Returned SVM score')
-title(sprintf('Random SVM: N=%d, D=%d',N,D))
View
17 debug_demos/test_times.m
@@ -1,17 +0,0 @@
-mall = repmat(models2,1,10);
-nex = 2:50:length(mall);
-times = zeros(size(nex));
-for i = 1:length(nex)
- r = randperm(length(mall));
- cur = mall(r(1:nex(i)));
- starter = tic;
- apply_voc_exemplars(cur);
- times(i)=toc(starter);
- figure(1)
- clf
- plot(nex,times,'r.');
- hold on;
- plot(nex,times2,'b.');
- drawnow
-end
-
View
66 demos/README.md
@@ -1,66 +0,0 @@
-Inside this directory you will find two demo files, one to show off Exemplar-svm training, and the other to show how to apply a pre-trained ensemble of exemplars on a test-set of images. These demos are meant to work with the PASCAL VOC 2007 dataset, so let's download some data!
-
-## Installing PASCAL VOC 2007 trainval/test sets
-``` sh
-$ mkdir /nfs/baikal/tmalisie/pascal #Make a directory for the PASCAL VOC data
-$ cd /nfs/baikal/tmalisie/pascal
-$ wget http://pascallin.ecs.soton.ac.uk/challenges/VOC/voc2007/VOCtrainval_06-Nov-2007.tar
-$ wget http://pascallin.ecs.soton.ac.uk/challenges/VOC/voc2007/VOCtest_06-Nov-2007.tar
-$ tar xf VOCtest_06-Nov-2007.tar
-$ tar xf VOCtrainval_06-Nov-2007.tar
-```
-
-## Downloading Exemplar-SVM MATLAB source code
-``` sh
-$ cd ~/projects/
-$ git clone git@github.com:quantombone/exemplarsvm.git #this will make ~/projects/exemplarsvm the code directory
-```
-
-## Making sure Exemplar-SVM library is compiled and working
-``` sh
-$ cd ~/projects/exemplarsvm
-$ matlab
-$ >> addpath(genpath(pwd));
-$ >> cd features/
-$ >> compile;
-```
----
-At this point you can choose to either train your own detector, or download the pre-trained PASCAL VOC 2007 detectors and use them to create detections in a collection of images
----
-# Train, Calibrate, and Test pipeline
-
-## Training an Exemplar-SVM "bus" detector
-``` sh
-$ cd ~/projects/exemplarsvm
-$ matlab
-$ >> addpath(genpath(pwd));
-$ >> voc_demo_esvm;
-```
-
-# Applying pre-trained models to a set of images
-## Download pre-trained models
-``` sh
-$ cd ~
-$ wget http://people.csail.mit.edu/tomasz/exemplarsvm-models.tar.gz
-$ gzip -d exemplarsvm-models.tar.gz
-$ tar xf exemplarsvm-models.tar #now ~/exemplarsvm-models/ contains all 20 category PASCAL VOC 2007 models
-```
-## How to run the Exemplar-SVM framework on a cluster
-
-This library was meant to run on a cluster with a shared NFS/AFS file structure where all nodes can
-read/write data from a common data source. The PASCAL VOC dataset
-must be installed there and the scratch space must also be present
-there. The idea is that scratch-work is written as .mat files and
-intermediate work is protected via .lock files. lock files are
-temporary files (they are directories actually) which are deleted once
-something has finished process. This means that the entire script can
-be replicated across a cluster, you can run the script 200x times and
-the training will happen in parallel.
-
-
-* Install PASCAL VOC dataset
-
-* Set working directory inside load_data_directory.m
-
-* Run voc_demo_esvm (trains all bus exemplars). To run this on a cluster, please see my [warp_scripts github repository](https://github.com/quantombone/warp_scripts)
-
View
50 demos/get_voc_dataset.m
@@ -1,50 +0,0 @@
-function dataset_params = get_voc_dataset(VOCYEAR, result_dir, datadir)
-%Get the dataset structure for a VOC dataset, given the VOCYEAR
-%string which is something like: VOC2007, VOC2010, ...
-
-% Issue warning if you are not me (tmalisie), but want default parameters
-if nargin ~= 3
- [tmp,user] = unix('whoami');
- user = strtrim(user);
- if strcmp(user,'tmalisie') == 0
- fprintf(1,'Warning user=%s, but defaults only defined for user=%s\n',...
- user,'tmalisie');
- end
-end
-
-if ~exist('result_dir','var')
- result_dir = '/nfs/baikal/tmalisie/nn311/';
- fprintf(1,'Using default dataset directory: %s\n', result_dir);
-end
-
-% Choose the number of images to process in each chunk (for detections)
-dataset_params.NIMS_PER_CHUNK = 4;
-
-% Create a root directory
-dataset_params.devkitroot = [result_dir '/' VOCYEAR];
-
-% change this path to a writable local directory for the example code
-dataset_params.localdir = [dataset_params.devkitroot '/local/'];
-
-% change this path to a writable directory for your results
-dataset_params.resdir = [dataset_params.devkitroot ['/' ...
- 'results/']];
-
-%This is location of the installed VOC datasets
-if ~exist('datadir','var')
- [v,r] = unix('hostname');
- if strfind(r,'airbone')==1
- dataset_params.datadir = '/projects/Pascal_VOC/';
- else
- dataset_params.datadir = '/nfs/hn38/users/sdivvala/Datasets/Pascal_VOC/';
- end
-else
- dataset_params.datadir = datadir;
-end
-
-%Some VOC-specific dataset stats
-dataset_params.dataset = VOCYEAR;
-dataset_params.testset = 'test';
-
-%Fill in the params structure with VOC-specific stuff
-dataset_params = VOCinit(dataset_params);
View
8 demos/load_data_directory.m
@@ -1,8 +0,0 @@
-function suffix = load_data_directory;
-%Function which returns the working path
-fprintf(1,'WARNING: please set your path in load_data_directory.m\n');
-
-%suffix = '/nfs/baikal/tmalisie/iccv11/';
-%suffix = '/nfs/baikal/tmalisie/nn311/';
-%suffix = '/nfs/baikal/tmalisie/small311/';
-suffix = '/lustre/tmalisie/small311/';
View
111 demos/old.demos/draw_memex.m
@@ -1,111 +0,0 @@
-function draw_memex(dataset_params, models, val_grid, val_set, M)
-%% draw the memex with connections that have calibrated score above
-%.5
-
-%% take all outgoing edges for each exemplar that calibrate to
-%above .5
-
-clsid = find(ismember(dataset_params.classes,models{1}.cls))
-
-N = length(models)*2;
-A = zeros(N,N);
-
-exstrings = cell(N,1);
-exstrings2 = cell(N,1);
-for i = 1:length(models)
- exstrings{i} = sprintf('%s.%d.0.png',models{i}.curid, ...
- models{i}.objectid);
-
- exstrings{length(models)+i} = sprintf('%s.%d.1.png',models{i}.curid, ...
- models{i}.objectid);
-
-
- exstrings2{i} = sprintf('%s.%d.1.png',models{i}.curid, ...
- models{i}.objectid);
-
- exstrings2{length(models)+i} = sprintf('%s.%d.0.png',models{i}.curid, ...
- models{i}.objectid);
-end
-
-%hitlist = {};
-
-for i = 1:length(val_grid)
- bbs = val_grid{i}.bboxes;
- bbs = calibrate_boxes(bbs,M.betas);
- os = val_grid{i}.extras.maxos;
- classes = val_grid{i}.extras.maxclass;
- ids = val_grid{i}.extras.maxind;
- %mb = max(bbs(:,end));
-
- goods = find(bbs(:,end)>.9 & os > .5 & classes == clsid);
- if length(goods) == 0
- continue
- end
-
- hitstrings = cell(length(goods),1);
- hitstrings2 = cell(length(goods),1);
- for j = 1:length(goods)
- isflip = double(bbs(goods(j),7)==1);
- hitstrings{j} = sprintf('%s.%d.%d.png',val_grid{i}.curid,...
- ids(goods(j)),isflip);
-
- hitstrings2{j} = sprintf('%s.%d.%d.png',val_grid{i}.curid,...
- ids(goods(j)),1-isflip);
- end
-
- %no flips
- %flip0 = goods(bbs(goods,7)==0);
-
- %yes flips
- %flip1 = goods(bbs(goods,7)==1);
-
- %curids = ids(flip0);
-
- [tmp1,target_ids] = ismember(hitstrings,exstrings);
- source_strings = exstrings(bbs(goods,6));
- [tmp2,source_ids] = ismember(source_strings,exstrings);
- scores = bbs(goods,end);
-
- [tmp12,target_ids2] = ismember(hitstrings2,exstrings);
- source_strings2 = exstrings(bbs(goods,6));
- [tmp22,source_ids2] = ismember(source_strings2,exstrings2);
- %scores = bbs(goods,end);
-
- goods2 = find(tmp1 & tmp2);
- target_ids = target_ids(goods2);
- source_ids = source_ids(goods2);
-
- target_ids2 = target_ids2(goods2);
- source_ids2 = source_ids2(goods2);
- scores = scores(goods2);
-
- for j = 1:length(target_ids)
- A(source_ids(j),target_ids(j)) = max(A(source_ids(j),target_ids(j)),...
- scores(j));
-
- A(source_ids2(j),target_ids2(j)) = max(A(source_ids2(j),target_ids2(j)),...
- scores(j));
- end
-
- fprintf(1,'.');
-end
-
-A = (A + A')/2;
-A = A - diag(diag(A));
-
-keepers = find((sum(A,1)>0));
-A2 = A(keepers,keepers);
-
-
-other.icon_string = @(i)sprintf('image="%s"', ...
- exstrings{keepers(i)});
-
-other.svg_file = sprintf('%s/icons/%s.pdf', ...
- dataset_params.localdir, models{1}.cls);
-other.gv_file = sprintf('%s/icons/%s.gv', ...
- dataset_params.localdir, models{1}.cls);
-
-%other.svg_file = svgfile;
-make_memex_graph(A2,other);
-
-
View
49 demos/old.demos/dump_memex_icons.m
@@ -1,49 +0,0 @@
-function dump_memex_icons(dataset_params,models)
-%Dump out little image icons (plus little hog image icons)
-
-basedir = [dataset_params.localdir '/icons/'];
-if ~exist(basedir,'dir')
- mkdir(basedir);
-end
-
-basedir2 = [dataset_params.localdir '/icons/' models{1}.cls];
-if ~exist(basedir2,'dir')
- mkdir(basedir2);
-end
-
-MAXDIM = 200;
-for i = 1:length(models)
- fprintf(1,'.');
- mstring0 = sprintf('%s/%s.%d.0.png',basedir,...
- models{i}.curid,models{i}.objectid);
- mstring1 = sprintf('%s/%s.%d.1.png',basedir,...
- models{i}.curid,models{i}.objectid);
-
- mstring0 = sprintf('%s/%s/%s.%s.%d.0.png',basedir,...
- models{i}.cls,models{i}.cls,models{i}.curid,models{i}.objectid);
- mstring1 = sprintf('%s/%s/%s.%s.%d.1.png',basedir,...
- models{i}.cls,models{i}.cls,models{i}.curid,models{i}.objectid);
-
- hstring0 = sprintf('%s/%s/%s.hog.%s.%d.0.png',basedir,...
- models{i}.cls,models{i}.cls,models{i}.curid,models{i}.objectid);
- hstring1 = sprintf('%s/%s/%s.hog.%s.%d.1.png',basedir,...
- models{i}.cls,models{i}.cls,models{i}.curid,models{i}.objectid);
-
- %if fileexists(mstring0) && fileexists(mstring1)
- % continue
- %end
-
- I = get_exemplar_icon(models,i);
- ms = max(size(I,1),size(I,2));
- I = imresize(I,MAXDIM/ms);
- I = max(0.0,min(1.0,I));
- imwrite(I,mstring0);
- I = flip_image(I);
- imwrite(I,mstring1);
-
- I2 = HOGpicture(models{i}.model.w);
- I2 = jettify(I2);
- imwrite(I2,hstring0);
- I2 = flip_image(I2);
- imwrite(I2,hstring1);
-end
View
89 demos/old.demos/plot_size2_plot.m
@@ -1,89 +0,0 @@
-%busmat
-n{1}='bus';
-c{1} = [.232 .352 .394; ...
- .172 .215 .316;...
- .236 .310 .397];
-
-n{2} = 'cow';
-c{2} =[.132 .155 .164;...
- .149 .166 .223;...
- .118 .147 .186];
-
-n{3}='diningtable';
-c{3}=[.093 .096 .102;...
- .007 .093 .053;...
- .016 .023 .111];
-
-n{4}='motorbike';
-c{4} =[.308 .310 .373;...
- .259 .269 .376;...
- .287 .320 .394];
-
-n{5}='sheep';
-c{5}=[.071 .180 .217;...
- .113 .157 .232;...
- .117 .167 .226];
-
-n{6}='train';
-c{6} = [.206 .308 .337;
- .111 .117 .133;
- .205 .291 .369];
-
-for i = 1:length(c)
- c{i} = c{i}([2 3 1],:);
-end
-
-
-figure(14)
-clf
-subplot(3,1,1)
-for i = 1:length(n)
- plot([50 100 200],c{i}(:,1),'LineWidth',4)
- hold all
-
-end
-
-for i = 1:length(n)
- plot([50 100 200],c{i}(:,1),'k.','MarkerSize',24)
- hold all;
-end
-legend(n,'Location','SouthEast');
-grid on;
-xlabel('#Negatives');
-ylabel('AP')
-title('ESVM')
-
-subplot(3,1,2)
-for i = 1:length(n)
- plot([50 100 200],c{i}(:,2),'LineWidth',4)
- hold all;
-end
-
-for i = 1:length(n)
- plot([50 100 200],c{i}(:,2),'k.','MarkerSize',24)
- hold all;
-end
-grid on;
-xlabel('#Negatives');
-ylabel('AP')
-title('ESVM+Cal')
-
-
-subplot(3,1,3)
-for i = 1:length(n)
- plot([200 50 100],c{i}(:,3),'LineWidth',4)
- hold all
-end
-for i = 1:length(n)
- plot([200 50 100],c{i}(:,3),'k.','MarkerSize',24);
-end
-grid on;
-xlabel('HOG Template Size');
-ylabel('AP')
-title('ESVM+Co')
-
-%set(gca,'XTick',[1 2 3 4])
-%set(gca,'XTickLabel',{'1','2','3','4'});
-
-set(gcf,'PaperPosition',[0 0 6 9]);
-print(gcf,'-depsc2','/nfs/baikal/tmalisie/nn311/hog-sizer3.eps')
View
119 demos/old.demos/plot_size3_plot.m
@@ -1,119 +0,0 @@
-%busmat
-n{1}='bus';
-c{1} = [.103 .269 .24;...
- .185 .296 .348;...
- .216 .304 .384;...
- .236 .310 .397];
-n{2} = 'cow';
-c{2} =[.100 .122 .149;...
- .121 .156 .164;...
- .130 .148 .178;...
- .118 .147 .186];
-
-n{3}='diningtable';
-c{3}=[.001 .048 .096;...
- .005 .018 .112;...
- .012 .019 .118;...
- .016 .023 .111];
-
-n{4}='motorbike';
-c{4} =[.164 .232 .253;...
- .248 .284 .338;...
- .269 .302 .377;...
- .287 .320 .394];
-n{5}='sheep';
-c{5}=[.098 .154 .163;...
- .053 .163 .198;...
- .074 .172 .239;...
- .117 .167 .226];
-
-n{6}='train';
-c{6} = [.101 .196 .256;...
- .124 .258 .315;...
- .184 .305 .362;...
- .205 .291 .369];
-
-cs = cat(3,c{:});
-ms = mean(cs,3);
-
-ms = [.102 .108 .164;
- .135 .170 .222;
- .163 .210 .281;
- .174 .233 .264];
-
-figure(14)
-clf
-%figure(1)
-%subplot(3,1,1)
-
-plot([25 50 100 200],ms(:,1),'r.-','LineWidth',4);
-hold on;
-plot([25 50 100 200],ms(:,2),'g','LineWidth',4);
-hold on;
-plot([25 50 100 200],ms(:,3),'b--','LineWidth',4);
-hold on;
-
-plot([25 50 100 200],ms(:,1),'r.','Marker','o','MarkerSize',12);
-hold on;
-plot([25 50 100 200],ms(:,2),'g.','Marker','o','MarkerSize',12);
-hold on;
-plot([25 50 100 200],ms(:,3),'b.','Marker','o','MarkerSize',12);
-hold on;
-
-
-% for i = 1:length(n)
-% plot([25 100 1000 2500],c{i}(:,1),'LineWidth',4)
-% hold all
-% end
-
-% for i = 1:length(n)
-% plot([25 100 1000 2500],c{i}(:,1),'k.','MarkerSize',24);
-% hold all;
-% end
-%legend(n,'Location','SouthEast');
-grid on;
-h=xlabel('HOG Template Size');
-set(h,'FontSize',18);
-h=ylabel('mAP')
-set(h,'FontSize',18);
-legend('ESVM','ESVM+Cal','ESVM+Co','Location','SouthEast');
-h=title('mAP versus HOG Template Size')
-set(h,'FontSize',24);
-
-set(gcf,'PaperPosition',[0 0 9 6]);
-print(gcf,'-depsc2','/nfs/baikal/tmalisie/nn311/hogsize_plot.eps')
-
-return
-subplot(3,1,2)
-for i = 1:length(n)
- plot([25 100 1000 2500],c{i}(:,2),'LineWidth',4);
- hold all;
-end
-
-for i = 1:length(n)
- plot([25 100 1000 2500],c{i}(:,2),'k.','MarkerSize',24);
- hold all;
-end
-grid on;
-xlabel('#Negatives');
-ylabel('AP')
-title('ESVM+Cal')
-
-subplot(3,1,3)
-for i = 1:length(n)
- plot([25 100 1000 2500],c{i}(:,3),'LineWidth',4)
- hold all
-end
-for i = 1:length(n)
- plot([25 100 1000 2500],c{i}(:,3),'k.','MarkerSize',24);
-end
-grid on;
-xlabel('#Negatives');
-ylabel('AP')
-title('ESVM+Co')
-
-%set(gca,'XTick',[1 2 3 4])
-%set(gca,'XTickLabel',{'1','2','3','4'});
-
-set(gcf,'PaperPosition',[0 0 6 9]);
-print(gcf,'-depsc2','/nfs/baikal/tmalisie/nn311/sizer3.eps')
View
114 demos/old.demos/plot_size_plot.m
@@ -1,114 +0,0 @@
-%busmat
-n{1}='bus';
-c{1} = [.103 .269 .24;...
- .185 .296 .348;...
- .216 .304 .384;...
- .236 .310 .397];
-n{2} = 'cow';
-c{2} =[.100 .122 .149;...
- .121 .156 .164;...
- .130 .148 .178;...
- .118 .147 .186];
-
-n{3}='diningtable';
-c{3}=[.001 .048 .096;...
- .005 .018 .112;...
- .012 .019 .118;...
- .016 .023 .111];
-
-n{4}='motorbike';
-c{4} =[.164 .232 .253;...
- .248 .284 .338;...
- .269 .302 .377;...
- .287 .320 .394];
-n{5}='sheep';
-c{5}=[.098 .154 .163;...
- .053 .163 .198;...
- .074 .172 .239;...
- .117 .167 .226];
-
-n{6}='train';
-c{6} = [.101 .196 .256;...
- .124 .258 .315;...
- .184 .305 .362;...
- .205 .291 .369];
-
-cs = cat(3,c{:});
-ms = mean(cs,3);
-
-figure(14)
-clf
-%figure(1)
-%subplot(3,1,1)
-
-plot([25 100 1000 2500],ms(:,1),'r.-','LineWidth',4);
-hold on;
-plot([25 100 1000 2500],ms(:,2),'g','LineWidth',4);
-hold on;
-plot([25 100 1000 2500],ms(:,3),'b--','LineWidth',4);
-hold on;
-
-plot([25 100 1000 2500],ms(:,1),'r.','Marker','o','MarkerSize',12);
-hold on;
-plot([25 100 1000 2500],ms(:,2),'g.','Marker','o','MarkerSize',12);
-hold on;
-plot([25 100 1000 2500],ms(:,3),'b.','Marker','o','MarkerSize',12);
-hold on;
-
-
-% for i = 1:length(n)
-% plot([25 100 1000 2500],c{i}(:,1),'LineWidth',4)
-% hold all
-% end
-
-% for i = 1:length(n)
-% plot([25 100 1000 2500],c{i}(:,1),'k.','MarkerSize',24);
-% hold all;
-% end
-%legend(n,'Location','SouthEast');
-grid on;
-h=xlabel('#Negatives');
-set(h,'FontSize',18);
-h=ylabel('AP')
-set(h,'FontSize',18);
-legend('ESVM','ESVM+Cal','ESVM+Co','Location','SouthEast');
-h=title('mAP versus Negative Set Size')
-set(h,'FontSize',24);
-
-set(gcf,'PaperPosition',[0 0 9 6]);
-print(gcf,'-depsc2','/nfs/baikal/tmalisie/nn311/size_plot.eps')
-
-return
-subplot(3,1,2)
-for i = 1:length(n)
- plot([25 100 1000 2500],c{i}(:,2),'LineWidth',4);
- hold all;
-end
-
-for i = 1:length(n)
- plot([25 100 1000 2500],c{i}(:,2),'k.','MarkerSize',24);
- hold all;
-end
-grid on;
-xlabel('#Negatives');
-ylabel('AP')
-title('ESVM+Cal')
-
-subplot(3,1,3)
-for i = 1:length(n)
- plot([25 100 1000 2500],c{i}(:,3),'LineWidth',4)
- hold all
-end
-for i = 1:length(n)
- plot([25 100 1000 2500],c{i}(:,3),'k.','MarkerSize',24);
-end
-grid on;
-xlabel('#Negatives');
-ylabel('AP')
-title('ESVM+Co')
-
-%set(gca,'XTick',[1 2 3 4])
-%set(gca,'XTickLabel',{'1','2','3','4'});
-
-set(gcf,'PaperPosition',[0 0 6 9]);
-print(gcf,'-depsc2','/nfs/baikal/tmalisie/nn311/sizer3.eps')
View
276 demos/old.demos/plot_voc_results.m
@@ -1,276 +0,0 @@
-function plot_voc_results(dataset_params)
-
-c = dataset_params.classes;
-
-names{5} = [dataset_params.models_name '-svm.%s_test_results.mat'];
-names{6} = [dataset_params.models_name '-svm.%s-calibrated_test_results.mat'];
-names{7} = [dataset_params.models_name '-svm.%s-calibrated-M_test_results.mat'];
-
-names{1} = [dataset_params.models_name '-normalizedhog.%s_test_results.mat'];
-names{2} = [dataset_params.models_name '-normalizedhog.%s-calibrated_test_results.mat'];
-%names{6} = [dataset_params.models_name '-normalizedhog.%s-calibrated-M_test_results.mat'];
-
-names{3} = [dataset_params.models_name '-dfun.%s_test_results.mat'];
-names{4} = [dataset_params.models_name '-dfun.%s-calibrated_test_results.mat'];
-%names{9} = [dataset_params.models_name '-dfun.%s-calibrated-M_test_results.mat'];
-
-%c = c(1:3);
-for i = 1:length(c)
- for j = 1:length(names)
- f = dir([dataset_params.resdir '/' sprintf(names{j},c{i})]);
- if length(f) == 0
- aps(i,j) = -.01;
- else
- f = load([dataset_params.resdir '/' f(1).name]);
- aps(i,j) = f.results.apold;
- end
- end
- aps(i,:);
- fprintf(1,'.');
-end
-
-cz = [.262 .409 -.01 -.01 -.01 .393 .432 -.01 -.01 -.01 -.01 -.01 ...
- -01 .375 -.01 -.01 -.01 -.01 .334 -.01];
-
-dt = [.127 .253 .005, .015, .107 .205 .23 .005 .021 .128 .014 .004 ...
- .122 .103 .101 .022 .056 .05 .12 .248];
-
-ldpm = [.287 .51 .006 .145 .265 .397 .502 .163 .165 .166 .245 .05 ...
- .452 .383 .362 .09 .174 .228 .341 .384]
-
-aps(:,end+1) = cz;
-aps(:,end+1) = dt(1:length(c));
-aps(:,end+1) = ldpm(1:length(c));
-
-imfiler = sprintf(['%s/res_table2.tex'],dataset_params.localdir);
-fid = fopen(imfiler,'w');
-fprintf(fid,['\\footnotesize\n\\begin{table}\n\\begin{center}\n\\begin{tabular}{|l||' ...
- 'c|c|c|c|c|c|c|c|c|c|}\n\\hline\n']);
-fprintf(fid,'& \\multicolumn{8}{|c|}{Exemplar Methods} & \\multicolumn{2}{|c|}{Global}\\\\\n');
-fprintf(fid,'\\hline\n');
-fprintf(fid,['Type & NHOG & NHOG+B & DFUN & DFUN+B & ESVM & ESVM+B' ...
- ' & ESVM+M & CZ & DT & LDPM\\\\\n']);
-fprintf(fid,'\\hline\n');
-
-aps2 = aps;
-aps2(aps2<0) = nan;
-aps(aps<0) = -.00000001;
-
-means = nanmean(aps2,1);
-%c = dataset_params.classes;
-for i = 1:length(c)
- fprintf(fid,'%s & %.3f & %.3f & %.3f & %.3f & %.3f & %.3f & %.3f & %.3f & %.3f & %.3f\\\\\n',...
- c{i},aps(i,1),aps(i,2),aps(i,3),aps(i,4),aps(i,5),aps(i,6),aps(i,7),aps(i,8),aps(i,9),aps(i,10));
-end
-fprintf(fid,'\\hline\n');
-fprintf(fid,'mAP & %.3f & %.3f & %.3f & %.3f & %.3f & %.3f & %.3f & %.3f & %.3f & %.3f\\\\\n',...
- means(1), means(2), means(3), means(4), means(5), means(6), ...
- means(7), means(8), means(9), means(10));
-
- % mean(aps(:,1)),mean(aps(:,2)),mean(aps(:,3)),mean(aps(:, ...
- % 4)),mean(aps(:,5)),mean(aps(:,6)),...
- % mean(aps(:,7)),mean(aps(:,8)),mean(aps(:,9)));
-fprintf(fid,'\\hline\n');
-fprintf(fid,'\\end{tabular}\n\\end{center}\n\\caption{hi}\n\\end{table}');
-fclose(fid);
-
-fprintf(1,'keyboard in plot results\n');
-keyboard
-
-files{1} = dir([dataset_params.resdir '/' m1 '*test_results.mat']);
-files{2} = dir([dataset_params.resdir '/' m1 '*calibrated' ...
- '_test_results.mat']);
-
-files{3} = dir([dataset_params.resdir '/' m1 '*calibrated-' ...
- 'M_test_results.mat']);
-
-files{1} = cellfun2(@(x)sprintf('%s/%s',dataset_params.resdir,x), ...
- {files{1}.name});
-files{2} = cellfun2(@(x)sprintf('%s/%s',dataset_params.resdir,x), ...
- {files{2}.name});
-files{3} = cellfun2(@(x)sprintf('%s/%s',dataset_params.resdir,x), ...
- {files{3}.name});
-
-files{1} = setdiff(files{1},files{2});
-files{1} = setdiff(files{1},files{3});
-
-figure(1)
-clf
-ha = tight_subplot(5, 4, .05, ...
- .1, .01);
-
-aps = [];
-for i = 1:length(files{1})
- %subplot(2,10,i)
-
- axes(ha(i));
- tic
- f1 = load(files{1}{i});
- f2 = load(files{2}{i});
- f3 = load(files{3}{i});
- toc
-
- %figure(1)
- %clf
- myplot(f1.results.recall,f1.results.prec,'k.-','LineWidth',2);
- hold on;
- myplot(f2.results.recall,f2.results.prec,'g--','LineWidth',2);
- hold on;
- myplot(f3.results.recall,f3.results.prec,'r-','LineWidth',2);
- grid;
-
-
- xlabel 'recall'
- ylabel 'precision'
- cls = dataset_params.classes{i};
- %title(sprintf('class: %s, subset: %s',...
- % cls,dataset_params.testset));
-
- title(sprintf('%s',...
- cls))
-
- s1 = sprintf('ESVM: AP=%.3f',...
- f1.results.apold);
-
- s2 = sprintf('ESVM+B: AP=%.3f',...
- f2.results.apold);
-
- s3 = sprintf('ESVM+B+M:+AP=%.3f',...
- f3.results.apold);
-
- aps(i,1) = f1.results.apold;
- aps(i,2) = f2.results.apold;
- aps(i,3) = f3.results.apold;
-
- % s1 = sprintf('AP = %.3f APold=%.3f',...
- % f1.results.ap,f1.results.apold);
-
- % s2 = sprintf('AP = %.3f APold=%.3f',...
- % f2.results.ap,f2.results.apold);
-
- % s3 = sprintf('AP = %.3f APold=%.3f',...
- % f3.results.ap,f3.results.apold);
-
- %title(sprintf('class: %s, subset: %s, AP = %.3f, APold=%.3f',...
- % cls,dataset_params.testset,f.results.ap,f.results.apold));
-
-
- grid on
-
- set(gca,'FontSize',16)
- set(get(gca,'Title'),'FontSize',16)
- set(get(gca,'YLabel'),'FontSize',16)
- set(get(gca,'XLabel'),'FontSize',16)
- axis([0 1 0 1.001]);
-
- legend({s1,s2,s3})
- drawnow
-end
-
-set(gcf,'PaperPosition',[0 0 20 40])
-set(gcf,'PaperSize',[20 40]);
-imfiler = sprintf(['%s/newall.pdf'],dataset_params.localdir);
-print(gcf,imfiler,'-dpdf');
-
-figure(2)
-clf
-bar(aps)
-axis([0 21 0 .5])
-set(gca,'XTick',1:21);
-set(gca,'XTickLabel','');
-
-blanky = '';
-for q = 1:20
- blanks{q}=blanky;
-end
-
-set(gca,'XTickLabel',blanks)
-set(gca,'XTick',1:21)
-classes = dataset_params.classes;
-
-for q = 1:length(classes)
- text(q-.1,-.02,classes(q),'Rotation',270+45,'FontSize',18,'FontWeight','Bold')
-end
-
-title('PASCAL VOC2007 Object Detection AP','FontSize',18, ...
- 'FontWeight','Bold')
-ylabel('AP','FontSize',18,'FontWeight','Bold');
-legend('ESVM','ESVM+B','ESVM+B+M')
-
-dt = [.127 .253 .005, .015, .107 .205 .23 .005 .021 .128 .014 .004 ...
- .122 .103 .101 .022 .056 .05 .12 .248];
-ldpm = [.287 .51 .006 .145 .265 .397 .502 .163 .165 .166 .245 .05 ...
- .452 .383 .362 .09 .174 .228 .341 .384]
-
-aps(:,4) = dt;
-aps(:,5) = ldpm;
-set(gcf,'PaperPosition',[0 0 16 4])
-set(gcf,'PaperSize',[16 4]);
-imfiler = sprintf(['%s/newbars.pdf'],dataset_params.localdir);
-print(gcf,imfiler,'-dpdf');
-
-imfiler = sprintf(['%s/res_table2.tex'],dataset_params.localdir);
-fid = fopen(imfiler,'w');
-fprintf(fid,['\\begin{table}\n\\begin{center}\n\\begin{tabular}{|l||' ...
- 'c|c|c|c|c|}\n\\hline\n'],tstr);
-fprintf(fid,'Type & ESVM & ESVM-B & ESVM-M & DT & LDPM\\\\\n');
-fprintf(fid,'\\hline\n');
-c = dataset_params.classes;
-for i = 1:20
- fprintf(fid,'%s & %.3f & %.3f & %.3f & %.3f & %.3f \\\\\n',...
- c{i},aps(i,1),aps(i,2),aps(i,3),aps(i,4),aps(i,5));
-end
-fprintf(fid,'\\hline\n');
-fprintf(fid,'mAP & %.3f & %.3f & %.3f & %.3f & %.3f \\\\\n',...
- mean(aps(:,1)),mean(aps(:,2)),mean(aps(:,3)),mean(aps(:, ...
- 4)),mean(aps(:,5)));
-fprintf(fid,'\\hline\n');
-fprintf(fid,'\\end{tabular}\n\\end{center}\n\\caption{hi}\n\\end{table}');
-fclose(fid);
-
-imfiler = sprintf(['%s/res_table.tex'],dataset_params.localdir);
-fid = fopen(imfiler,'w');
-tstr = '{c';
-
-for i = 1:21
- tstr = [tstr '|c'];
-end
-tstr = [tstr '}'];
-
-
-fprintf(fid,'\\begin{table}\n\\begin{center}\n\\begin{tabular}%s\n\\hline\n',tstr);
-fprintf(fid,'Class & %s ',c{1});
-for i = 2:20
- fprintf(fid,' & %s ',c{i});
-end
-
-fprintf(fid,' & mAP \\\\ \n');
-fprintf(fid,'\\hline\n');
-
-fprintf(fid,'MODE1 & %.2f ',aps(1,1));
-for i = 2:20
- fprintf(fid,' & %.2f',aps(i,1));
-end
-fprintf(fid,'& %.2f\\\\ \n',mean(aps(:,1)));
-
-fprintf(fid,'MODE2 & %.2f ',aps(1,2));
-for i = 2:20
- fprintf(fid,' & %.2f ',aps(i,2));
-end
-fprintf(fid,' & %.2f\\\\ \n',mean(aps(:,2)));
-
-fprintf(fid,'MODE3 & %.2f ',aps(1,3));
-for i = 2:20
- fprintf(fid,' & %.2f ',aps(i,3));
-end
-fprintf(fid,'& %.2f \\\\ \n',mean(aps(:,3)));
-fprintf(fid,'\\end{tabular}\n\\end{center}\n\\caption{hi}\n\\end{table}');
-
-fclose(fid);
-
-keyboard
-
-function myplot(x,y,col,lstring,lwidth)
-N = length(x);
-N = min(N,5000);
-plot(x(1:N),y(1:N),col,lstring,lwidth)
View
253 demos/old.demos/plot_voc_results3.m
@@ -1,253 +0,0 @@
-function plot_voc_results3(dataset_params)
-
-c = dataset_params.classes;
-
-
-names{1} = [dataset_params.models_name '-svm.%s_test_results.mat'];
-names{2} = [dataset_params.models_name '-svm.%s-calibrated_test_results.mat'];
-names{3} = [dataset_params.models_name '-svm.%s-calibrated-M_test_results.mat'];
-
-
-for i = 1:length(c)
- for j = 1:length(names)
- f = dir([dataset_params.resdir '/' sprintf(names{j},c{i})]);
-
- if length(f) == 0
- aps(i,j) = -.01;
- else
- f = load([dataset_params.resdir '/' f(1).name]);
- aps(i,j) = f.results.apold;
- end
- end
- aps(i,:);
- fprintf(1,'.');
-end
-
-imfiler = sprintf(['%s/res_table3.tex'],dataset_params.localdir);
-fid = fopen(imfiler,'w');
-fprintf(fid,['\\footnotesize\n\\begin{table}\n\\begin{center}\n\\begin{tabular}{|l||' ...
- 'c|c|c|}\n\\hline\n']);
-fprintf(fid,'\\hline\n');
-fprintf(fid,['Type & ESVM & ESVM+B' ...
- ' & ESVM+M \\\\\n']);
-fprintf(fid,'\\hline\n');
-
-aps2 = aps;
-aps2(aps2<0) = nan;
-aps(aps<0) = -.00000001;
-
-means = nanmean(aps2,1);
-
-for i = 1:length(c)
- fprintf(fid,'%s & %.3f & %.3f & %.3f \\\\\n',...
- c{i},aps(i,1),aps(i,2),aps(i,3));
-end
-fprintf(fid,'\\hline\n');
-fprintf(fid,'mAP & %.3f & %.3f & %.3f \\\\\n',...
- means(1), means(2), means(3));
-
-fprintf(fid,'\\hline\n');
-fprintf(fid,'\\end{tabular}\n\\end{center}\n\\caption{hi}\n\\end{table}');
-fclose(fid);
-
-fprintf(1,'keyboard in plot results\n');
-return;
-
-
-files{1} = dir([dataset_params.resdir '/' m1 '*test_results.mat']);
-files{2} = dir([dataset_params.resdir '/' m1 '*calibrated' ...
- '_test_results.mat']);
-
-files{3} = dir([dataset_params.resdir '/' m1 '*calibrated-' ...
- 'M_test_results.mat']);
-
-files{1} = cellfun2(@(x)sprintf('%s/%s',dataset_params.resdir,x), ...
- {files{1}.name});
-files{2} = cellfun2(@(x)sprintf('%s/%s',dataset_params.resdir,x), ...
- {files{2}.name});
-files{3} = cellfun2(@(x)sprintf('%s/%s',dataset_params.resdir,x), ...
- {files{3}.name});
-
-files{1} = setdiff(files{1},files{2});
-files{1} = setdiff(files{1},files{3});
-
-figure(1)
-clf
-ha = tight_subplot(5, 4, .05, ...
- .1, .01);
-
-aps = [];
-for i = 1:length(files{1})
- %subplot(2,10,i)
-
- axes(ha(i));
- tic
- f1 = load(files{1}{i});
- f2 = load(files{2}{i});
- f3 = load(files{3}{i});
- toc
-
- %figure(1)
- %clf
- myplot(f1.results.recall,f1.results.prec,'k.-','LineWidth',2);
- hold on;
- myplot(f2.results.recall,f2.results.prec,'g--','LineWidth',2);
- hold on;
- myplot(f3.results.recall,f3.results.prec,'r-','LineWidth',2);
- grid;
-
-
- xlabel 'recall'
- ylabel 'precision'
- cls = dataset_params.classes{i};
- %title(sprintf('class: %s, subset: %s',...
- % cls,dataset_params.testset));
-
- title(sprintf('%s',...
- cls))
-
- s1 = sprintf('ESVM: AP=%.3f',...
- f1.results.apold);
-
- s2 = sprintf('ESVM+B: AP=%.3f',...
- f2.results.apold);
-
- s3 = sprintf('ESVM+B+M:+AP=%.3f',...
- f3.results.apold);
-
- aps(i,1) = f1.results.apold;
- aps(i,2) = f2.results.apold;
- aps(i,3) = f3.results.apold;
-
- % s1 = sprintf('AP = %.3f APold=%.3f',...
- % f1.results.ap,f1.results.apold);
-
- % s2 = sprintf('AP = %.3f APold=%.3f',...
- % f2.results.ap,f2.results.apold);
-
- % s3 = sprintf('AP = %.3f APold=%.3f',...
- % f3.results.ap,f3.results.apold);
-
- %title(sprintf('class: %s, subset: %s, AP = %.3f, APold=%.3f',...
- % cls,dataset_params.testset,f.results.ap,f.results.apold));
-
-
- grid on
-
- set(gca,'FontSize',16)
- set(get(gca,'Title'),'FontSize',16)
- set(get(gca,'YLabel'),'FontSize',16)
- set(get(gca,'XLabel'),'FontSize',16)
- axis([0 1 0 1.001]);
-
- legend({s1,s2,s3})
- drawnow
-end
-
-set(gcf,'PaperPosition',[0 0 20 40])
-set(gcf,'PaperSize',[20 40]);
-imfiler = sprintf(['%s/newall.pdf'],dataset_params.localdir);
-print(gcf,imfiler,'-dpdf');
-
-figure(2)
-clf
-bar(aps)
-axis([0 21 0 .5])
-set(gca,'XTick',1:21);
-set(gca,'XTickLabel','');
-
-blanky = '';
-for q = 1:20
- blanks{q}=blanky;
-end
-
-set(gca,'XTickLabel',blanks)
-set(gca,'XTick',1:21)
-classes = dataset_params.classes;
-
-for q = 1:length(classes)
- text(q-.1,-.02,classes(q),'Rotation',270+45,'FontSize',18,'FontWeight','Bold')
-end
-
-title('PASCAL VOC2007 Object Detection AP','FontSize',18, ...
- 'FontWeight','Bold')
-ylabel('AP','FontSize',18,'FontWeight','Bold');
-legend('ESVM','ESVM+B','ESVM+B+M')
-
-dt = [.127 .253 .005, .015, .107 .205 .23 .005 .021 .128 .014 .004 ...
- .122 .103 .101 .022 .056 .05 .12 .248];
-ldpm = [.287 .51 .006 .145 .265 .397 .502 .163 .165 .166 .245 .05 ...
- .452 .383 .362 .09 .174 .228 .341 .384]
-
-aps(:,4) = dt;
-aps(:,5) = ldpm;
-set(gcf,'PaperPosition',[0 0 16 4])
-set(gcf,'PaperSize',[16 4]);
-imfiler = sprintf(['%s/newbars.pdf'],dataset_params.localdir);
-print(gcf,imfiler,'-dpdf');
-
-imfiler = sprintf(['%s/res_table2.tex'],dataset_params.localdir);
-fid = fopen(imfiler,'w');
-fprintf(fid,['\\begin{table}\n\\begin{center}\n\\begin{tabular}{|l||' ...
- 'c|c|c|c|c|}\n\\hline\n'],tstr);
-fprintf(fid,'Type & ESVM & ESVM-B & ESVM-M & DT & LDPM\\\\\n');
-fprintf(fid,'\\hline\n');
-c = dataset_params.classes;
-for i = 1:20
- fprintf(fid,'%s & %.3f & %.3f & %.3f & %.3f & %.3f \\\\\n',...
- c{i},aps(i,1),aps(i,2),aps(i,3),aps(i,4),aps(i,5));
-end
-fprintf(fid,'\\hline\n');
-fprintf(fid,'mAP & %.3f & %.3f & %.3f & %.3f & %.3f \\\\\n',...
- mean(aps(:,1)),mean(aps(:,2)),mean(aps(:,3)),mean(aps(:, ...
- 4)),mean(aps(:,5)));
-fprintf(fid,'\\hline\n');
-fprintf(fid,'\\end{tabular}\n\\end{center}\n\\caption{hi}\n\\end{table}');
-fclose(fid);
-
-imfiler = sprintf(['%s/res_table.tex'],dataset_params.localdir);
-fid = fopen(imfiler,'w');
-tstr = '{c';
-
-for i = 1:21
- tstr = [tstr '|c'];
-end
-tstr = [tstr '}'];
-
-
-fprintf(fid,'\\begin{table}\n\\begin{center}\n\\begin{tabular}%s\n\\hline\n',tstr);
-fprintf(fid,'Class & %s ',c{1});
-for i = 2:20
- fprintf(fid,' & %s ',c{i});
-end
-
-fprintf(fid,' & mAP \\\\ \n');
-fprintf(fid,'\\hline\n');
-
-fprintf(fid,'MODE1 & %.2f ',aps(1,1));
-for i = 2:20
- fprintf(fid,' & %.2f',aps(i,1));
-end
-fprintf(fid,'& %.2f\\\\ \n',mean(aps(:,1)));
-
-fprintf(fid,'MODE2 & %.2f ',aps(1,2));
-for i = 2:20
- fprintf(fid,' & %.2f ',aps(i,2));
-end
-fprintf(fid,' & %.2f\\\\ \n',mean(aps(:,2)));
-
-fprintf(fid,'MODE3 & %.2f ',aps(1,3));
-for i = 2:20
- fprintf(fid,' & %.2f ',aps(i,3));
-end
-fprintf(fid,'& %.2f \\\\ \n',mean(aps(:,3)));
-fprintf(fid,'\\end{tabular}\n\\end{center}\n\\caption{hi}\n\\end{table}');
-
-fclose(fid);
-
-keyboard
-
-function myplot(x,y,col,lstring,lwidth)
-N = length(x);
-N = min(N,5000);
-plot(x(1:N),y(1:N),col,lstring,lwidth)
View
293 demos/old.demos/plot_voc_results_horiz.m
@@ -1,293 +0,0 @@
-function plot_voc_results_horiz(dataset_params)
-%Horizontal plotting of results
-
-c = dataset_params.classes;
-
-names{5} = [dataset_params.models_name '-svm.%s_test_results.mat'];
-names{6} = [dataset_params.models_name '-svm.%s-calibrated_test_results.mat'];
-names{7} = [dataset_params.models_name '-svm.%s-calibrated-M_test_results.mat'];
-
-names{1} = [dataset_params.models_name '-normalizedhog.%s_test_results.mat'];
-names{2} = [dataset_params.models_name '-normalizedhog.%s-calibrated_test_results.mat'];
-%names{6} = [dataset_params.models_name '-normalizedhog.%s-calibrated-M_test_results.mat'];
-
-names{3} = [dataset_params.models_name '-dfun.%s_test_results.mat'];
-names{4} = [dataset_params.models_name '-dfun.%s-calibrated_test_results.mat'];
-%names{9} = [dataset_params.models_name '-dfun.%s-calibrated-M_test_results.mat'];
-
-%c = c(1:3);
-for i = 1:length(c)
- for j = 1:length(names)
- f = dir([dataset_params.resdir '/' sprintf(names{j},c{i})]);
- if length(f) == 0
- aps(i,j) = -.01;
- else
- f = load([dataset_params.resdir '/' f(1).name]);
- aps(i,j) = f.results.apold;
- end
- end
- aps(i,:);
- fprintf(1,'.');
-end
-
-cz = [.262 .409 -.01 -.01 -.01 .393 .432 -.01 -.01 -.01 -.01 -.01 ...