Skip to content

Commit fd924b2

Browse files
author
Carsten Griwodz
committed
[sift] Remove option to create all octaves directly from the input
1 parent e4e114a commit fd924b2

File tree

7 files changed

+11
-66
lines changed

7 files changed

+11
-66
lines changed

src/application/main.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ static void parseargs(int argc, char** argv, popsift::Config& config, string& in
8888
"reject points when reaching max iterations, "
8989
"first contrast threshold is floor(.5 * peak thresh). "
9090
"Computed filter width are lower than VLFeat/PopSift")
91-
("direct-scaling", bool_switch()->notifier([&](bool b) { if(b) config.setScalingMode(popsift::Config::ScaleDirect); }),
92-
"Direct each octave from upscaled orig instead of blurred level.")
9391
("norm-multi", value<int>()->notifier([&](int i) {config.setNormalizationMultiplier(i); }), "Multiply the descriptor by pow(2,<int>).")
9492
( "norm-mode", value<std::string>()->notifier([&](const std::string& s) { config.setNormMode(s); }),
9593
popsift::Config::getNormModeUsage() )

src/application/match.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ static void parseargs(int argc, char** argv, popsift::Config& config, string& lF
8686
"reject points when reaching max iterations, "
8787
"first contrast threshold is floor(.5 * peak thresh). "
8888
"Computed filter width are lower than VLFeat/PopSift")
89-
("direct-scaling", bool_switch()->notifier([&](bool b) { if(b) config.setScalingMode(popsift::Config::ScaleDirect); }),
90-
"Direct each octave from upscaled orig instead of blurred level.")
9189
("norm-multi", value<int>()->notifier([&](int i) {config.setNormalizationMultiplier(i); }), "Multiply the descriptor by pow(2,<int>).")
9290
( "norm-mode", value<std::string>()->notifier([&](const std::string& s) { config.setNormMode(s); }),
9391
popsift::Config::getNormModeUsage() )

src/popsift/s_pyramid_build.cu

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,12 @@ void make_dog( cudaTextureObject_t src_data,
9494
} // namespace gauss
9595

9696
__host__
97-
inline void Pyramid::horiz_from_input_image( const Config& conf, ImageBase* base, int octave, cudaStream_t stream )
97+
inline void Pyramid::horiz_from_input_image( const Config& conf, ImageBase* base, cudaStream_t stream )
9898
{
99+
// Variable octave is a leftover of a parameter from the attempt to create
100+
// the top level of every octave directly from the upscaled input
101+
const int octave = 0;
102+
99103
Octave& oct_obj = _octaves[octave];
100104

101105
const int width = oct_obj.getWidth();
@@ -475,16 +479,7 @@ void Pyramid::build_pyramid( const Config& conf, ImageBase* base )
475479
Octave& oct_obj = _octaves[octave];
476480
cudaStream_t stream = oct_obj.getStream();
477481

478-
if( ( conf.getScalingMode() == Config::ScaleDirect ) &&
479-
( conf.getGaussMode() == Config::Fixed9 || conf.getGaussMode() == Config::Fixed15 ) ) {
480-
if( octave == 0 ) {
481-
make_octave( conf, base, oct_obj, stream, true );
482-
} else {
483-
horiz_from_input_image( conf, base, octave, stream );
484-
vert_from_interm( octave, 0, stream, NotInterpolated_FromPrevious );
485-
make_octave( conf, base, oct_obj, stream, false );
486-
}
487-
} else if( conf.getGaussMode() == Config::Fixed9 || conf.getGaussMode() == Config::Fixed15 ) {
482+
if( conf.getGaussMode() == Config::Fixed9 || conf.getGaussMode() == Config::Fixed15 ) {
488483
if( octave == 0 ) {
489484
make_octave( conf, base, oct_obj, stream, true );
490485
} else {
@@ -496,30 +491,14 @@ void Pyramid::build_pyramid( const Config& conf, ImageBase* base )
496491
}
497492

498493
cuda::event_record( oct_obj.getEventScaleDone(), stream, __FILE__, __LINE__ );
499-
} else if( conf.getScalingMode() == Config::ScaleDirect ) {
500-
GaussTableChoice useGauss = ( conf.getGaussMode() == Config::VLFeat_Relative ) ? Interpolated_FromPrevious
501-
: NotInterpolated_FromPrevious;
502-
for( int level=0; level<_levels; level++ )
503-
{
504-
if( level == 0 )
505-
{
506-
horiz_from_input_image( conf, base, octave, stream );
507-
vert_from_interm( octave, level, stream, useGauss );
508-
}
509-
else
510-
{
511-
horiz_from_prev_level( octave, level, stream, useGauss );
512-
vert_from_interm( octave, level, stream, useGauss );
513-
}
514-
}
515494
} else if( conf.getGaussMode() == Config::VLFeat_Relative ) {
516495
for( int level=0; level<_levels; level++ )
517496
{
518497
if( level == 0 )
519498
{
520499
if( octave == 0 )
521500
{
522-
horiz_from_input_image( conf, base, 0, stream );
501+
horiz_from_input_image( conf, base, stream );
523502
vert_from_interm( octave, 0, stream, Interpolated_FromPrevious );
524503
}
525504
else
@@ -551,7 +530,7 @@ void Pyramid::build_pyramid( const Config& conf, ImageBase* base )
551530
{
552531
if( octave == 0 )
553532
{
554-
horiz_from_input_image( conf, base, 0, stream );
533+
horiz_from_input_image( conf, base, stream );
555534
vert_from_interm( octave, 0, stream, NotInterpolated_FromPrevious );
556535
}
557536
else

src/popsift/s_pyramid_build_ra.cu

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ void horiz( cudaTextureObject_t src_linear_tex,
2222
int octave,
2323
float shift )
2424
{
25-
// Create level-0 for any octave from the input image.
26-
// Since we are computing the direct-downscaling gauss filter tables
27-
// and the first entry in that table is identical to the "normal"
28-
// table, we do not need a special case.
25+
// Create level-0 for the first octave from the input image.
26+
// TODO: octave is always 0
27+
// remove the unused levels of d_gauss.dd.span and d_gauss.dd.filter
2928

3029
const int write_x = blockIdx.x * blockDim.x + threadIdx.x;
3130
const int write_y = blockIdx.y;

src/popsift/sift_conf.cu

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ Config::Config( )
2525
, _gauss_mode( getGaussModeDefault() )
2626
, _sift_mode( Config::PopSift )
2727
, _log_mode( Config::None )
28-
, _scaling_mode( Config::ScaleDefault )
2928
, _desc_mode( Config::Loop )
3029
, _grid_filter_mode( Config::RandomScale )
3130
, verbose( false )
@@ -182,11 +181,6 @@ Config::LogMode Config::getLogMode( ) const
182181
return _log_mode;
183182
}
184183

185-
void Config::setScalingMode( ScalingMode mode )
186-
{
187-
_scaling_mode = mode;
188-
}
189-
190184
/**
191185
* Normalization mode
192186
* Should the descriptor normalization use L2-like classic normalization
@@ -313,7 +307,6 @@ bool Config::equal( const Config& other ) const
313307
COMPARE( _edge_limit ) ||
314308
COMPARE( _threshold ) ||
315309
COMPARE( _upscale_factor ) ||
316-
COMPARE( _scaling_mode ) ||
317310
COMPARE( _max_extrema ) ||
318311
COMPARE( _gauss_mode ) ||
319312
COMPARE( _sift_mode ) ||

src/popsift/sift_conf.h

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,6 @@ struct Config
6969
All
7070
};
7171

72-
/**
73-
* @brief The scaling mode.
74-
*/
75-
enum ScalingMode
76-
{
77-
ScaleDirect,
78-
/// Indirect - only working method
79-
ScaleDefault
80-
};
81-
8272
/**
8373
* @brief Modes for descriptor extraction.
8474
*/
@@ -164,7 +154,6 @@ struct Config
164154
* @see LogMode
165155
*/
166156
void setLogMode( LogMode mode = All );
167-
void setScalingMode( ScalingMode mode = ScaleDefault );
168157

169158
/**
170159
* @brief Enable/desable verbose mode.
@@ -328,13 +317,6 @@ struct Config
328317
*/
329318
GridFilterMode getFilterSorting() const { return _grid_filter_mode; }
330319

331-
/**
332-
* @brief Get the scaling mode.
333-
* @return the descriptor extraction mode.
334-
* @see ScalingMode
335-
*/
336-
inline ScalingMode getScalingMode() const { return _scaling_mode; }
337-
338320
/**
339321
* @brief Get the descriptor extraction mode
340322
* @return the descriptor extraction mode
@@ -361,9 +343,6 @@ struct Config
361343
/// default LogMode::None
362344
LogMode _log_mode;
363345

364-
/// default: ScalingMode::DownscaledOctaves
365-
ScalingMode _scaling_mode;
366-
367346
/// default: DescMode::Loop
368347
DescMode _desc_mode;
369348

src/popsift/sift_pyramid.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ class Pyramid
116116
private:
117117
inline void horiz_from_input_image( const Config& conf,
118118
ImageBase* base,
119-
int octave,
120119
cudaStream_t stream );
121120
inline void horiz_level_from_input_image( const Config& conf,
122121
ImageBase* base,

0 commit comments

Comments
 (0)