-
Notifications
You must be signed in to change notification settings - Fork 124
Fix/vlfeat compliance #112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 12 commits
1e4d1df
fa695d6
608eac5
0b8fb18
92f1846
a529cad
a9ca694
003e7ea
52c3cbe
5c0256f
bf59959
d93b8e3
9349547
942aea1
aea885e
b7bbcd2
b3f8434
e9ec403
cbf70d0
2708e89
bbc0e75
1ea511e
6eeaee3
e370180
5591c5b
6faa3f4
3cdc329
59a70c0
1a54748
085694b
3673a85
bd1c8ef
74f7053
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,6 +42,7 @@ using namespace std; | |
| static bool print_dev_info = false; | ||
| static bool print_time_info = false; | ||
| static bool write_as_uchar = false; | ||
| static bool write_with_ori = false; | ||
| static bool dont_write = false; | ||
| static bool pgmread_loading = false; | ||
| static bool float_mode = false; | ||
|
|
@@ -64,13 +65,13 @@ static void parseargs(int argc, char** argv, popsift::Config& config, string& in | |
| parameters.add_options() | ||
| ("octaves", value<int>(&config.octaves), "Number of octaves") | ||
| ("levels", value<int>(&config.levels), "Number of levels per octave") | ||
| ("sigma", value<float>()->notifier([&](float f) { config.setSigma(f); }), "Initial sigma value") | ||
| ("sigma", value<float>()->notifier([&](float f) { config.setSigma(f); }), "Initial sigma value (default 1.6)") | ||
|
|
||
| ("threshold", value<float>()->notifier([&](float f) { config.setThreshold(f); }), "Contrast threshold") | ||
| ("edge-threshold", value<float>()->notifier([&](float f) { config.setEdgeLimit(f); }), "On-edge threshold") | ||
| ("threshold", value<float>()->notifier([&](float f) { config.setThreshold(f); }), "Contrast threshold (default 0.04)") | ||
| ("edge-threshold", value<float>()->notifier([&](float f) { config.setEdgeLimit(f); }), "On-edge threshold (default 10.0)") | ||
| ("edge-limit", value<float>()->notifier([&](float f) { config.setEdgeLimit(f); }), "On-edge threshold") | ||
| ("downsampling", value<float>()->notifier([&](float f) { config.setDownsampling(f); }), "Downscale width and height of input by 2^N") | ||
| ("initial-blur", value<float>()->notifier([&](float f) {config.setInitialBlur(f); }), "Assume initial blur, subtract when blurring first time"); | ||
| ("initial-blur", value<float>()->notifier([&](float f) {config.setInitialBlur(f); }), "Assume initial blur, subtract when blurring first time (default 0.5)"); | ||
| } | ||
| options_description modes("Modes"); | ||
| { | ||
|
|
@@ -81,9 +82,9 @@ static void parseargs(int argc, char** argv, popsift::Config& config, string& in | |
| // "Options are: vlfeat, relative, relative-all, opencv, fixed9, fixed15" | ||
| ("desc-mode", value<std::string>()->notifier([&](const std::string& s) { config.setDescMode(s); }), | ||
| "Choice of descriptor extraction modes:\n" | ||
| "loop, iloop, grid, igrid, notile\n" | ||
| "loop, iloop, grid, igrid, notile, vlfeat\n" | ||
| "Default is loop\n" | ||
| "loop is OpenCV-like horizontal scanning, computing only valid points, grid extracts only useful points but rounds them, iloop uses linear texture and rotated gradiant fetching. igrid is grid with linear interpolation. notile is like igrid but avoids redundant gradiant fetching.") | ||
| "loop is OpenCV-like horizontal scanning, computing only valid points, grid extracts only useful points but rounds them, iloop uses linear texture and rotated gradiant fetching. igrid is grid with linear interpolation. notile is like igrid but avoids redundant gradiant fetching, vlfeat replicates vlfeat behaviour.") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe briefly remind the vlfeat behaviour like done for opencv for example
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have extended it and move it to Config::getDescModeUsage(). The usage is getting very long, I wonder if we should re-write this to support --desc-mode=? |
||
| ("popsift-mode", bool_switch()->notifier([&](bool b) { if(b) config.setMode(popsift::Config::PopSift); }), | ||
| "During the initial upscale, shift pixels by 1. In extrema refinement, steps up to 0.6, do not reject points when reaching max iterations, " | ||
| "first contrast threshold is .8 * peak thresh. Shift feature coords octave 0 back to original pos.") | ||
|
|
@@ -118,6 +119,7 @@ static void parseargs(int argc, char** argv, popsift::Config& config, string& in | |
| ("print-time-info", bool_switch(&print_time_info)->default_value(false), "A debug output printing image processing time after load()") | ||
| ("write-as-uchar", bool_switch(&write_as_uchar)->default_value(false), "Output descriptors rounded to int.\n" | ||
| "Scaling to sensible ranges is not automatic, should be combined with --norm-multi=9 or similar") | ||
| ("write-with-ori", bool_switch(&write_with_ori)->default_value(false), "Output points are written with sigma and orientation.\n") | ||
| ("dont-write", bool_switch(&dont_write)->default_value(false), "Suppress descriptor output") | ||
| ("pgmread-loading", bool_switch(&pgmread_loading)->default_value(false), "Use the old image loader instead of LibDevIL") | ||
| ("float-mode", bool_switch(&float_mode)->default_value(false), "Upload image to GPU as float instead of byte") | ||
|
|
@@ -254,7 +256,7 @@ void read_job( SiftJob* job, bool really_write ) | |
| nvtxRangePushA( "Writing features to disk" ); | ||
|
|
||
| std::ofstream of( "output-features.txt" ); | ||
| feature_list->print( of, write_as_uchar ); | ||
| feature_list->print( of, write_as_uchar, write_with_ori ); | ||
| } | ||
| delete feature_list; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,15 +58,15 @@ void NormalizeL2::normalize( const float* src_desc, float* dst_desc, const bool | |
| float norm; | ||
|
|
||
| if( threadIdx.x == 0 ) { | ||
| norm = normf( 128, src_desc ); | ||
| norm = rnormf( 128, src_desc ); // 1/sqrt(sum of squares) | ||
| } | ||
| __syncthreads(); | ||
| norm = popsift::shuffle( norm, 0 ); | ||
|
|
||
| descr.x = min( descr.x, 0.2f*norm ); | ||
| descr.y = min( descr.y, 0.2f*norm ); | ||
| descr.z = min( descr.z, 0.2f*norm ); | ||
| descr.w = min( descr.w, 0.2f*norm ); | ||
| descr.x = min( descr.x*norm, 0.2f ); | ||
| descr.y = min( descr.y*norm, 0.2f ); | ||
| descr.z = min( descr.z*norm, 0.2f ); | ||
| descr.w = min( descr.w*norm, 0.2f ); | ||
|
|
||
| norm = descr.x * descr.x | ||
| + descr.y * descr.y | ||
|
|
@@ -96,14 +96,14 @@ void NormalizeL2::normalize( const float* src_desc, float* dst_desc, const bool | |
| norm += popsift::shuffle_down( norm, 2 ); | ||
| norm += popsift::shuffle_down( norm, 1 ); | ||
| if( threadIdx.x == 0 ) { | ||
| norm = __fsqrt_rn( norm ); | ||
| norm = __frsqrt_rn( norm ); | ||
| } | ||
| norm = popsift::shuffle( norm, 0 ); | ||
|
|
||
| descr.x = min( descr.x, 0.2f*norm ); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I made a direct comparison between the develop branch and develop with the L2 normalization bug fixed. |
||
| descr.y = min( descr.y, 0.2f*norm ); | ||
| descr.z = min( descr.z, 0.2f*norm ); | ||
| descr.w = min( descr.w, 0.2f*norm ); | ||
| descr.x = min( descr.x*norm, 0.2f ); | ||
| descr.y = min( descr.y*norm, 0.2f ); | ||
| descr.z = min( descr.z*norm, 0.2f ); | ||
| descr.w = min( descr.w*norm, 0.2f ); | ||
|
|
||
| norm = descr.x * descr.x | ||
| + descr.y * descr.y | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.