Skip to content

Commit

Permalink
this is not going anywhere, I am going to restart icf
Browse files Browse the repository at this point in the history
  • Loading branch information
liuliu committed Apr 22, 2013
1 parent e7361af commit b2c26e7
Show file tree
Hide file tree
Showing 5 changed files with 274 additions and 89 deletions.
8 changes: 7 additions & 1 deletion bin/icfcreate.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ int main(int argc, char** argv)
{"working-dir", 1, 0, 0},
{"negative-count", 1, 0, 0},
{"positive-count", 1, 0, 0},
{"acceptance", 1, 0, 0},
/* optional parameters */
{"base-dir", 1, 0, 0},
{0, 0, 0, 0}
Expand All @@ -31,6 +32,7 @@ int main(int argc, char** argv)
char* base_dir = 0;
int negative_count = 0;
int positive_count = 0;
double acceptance = 0;
ccv_icf_param_t detector = { .min_neighbors = 0, .flags = 0, .threshold = 0.0 };
ccv_icf_new_param_t params = {
.detector = detector,
Expand Down Expand Up @@ -58,6 +60,9 @@ int main(int argc, char** argv)
positive_count = atoi(optarg);
break;
case 6:
acceptance = atof(optarg);
break;
case 7:
base_dir = optarg;
break;
}
Expand Down Expand Up @@ -117,10 +122,11 @@ int main(int argc, char** argv)
params.deform_angle = 1;
params.deform_scale = 0.1;
params.C = 0.002;
params.feature_size = 15000;
params.feature_size = 30000;
params.select_feature_size = 1500;
params.sample_rate = 0.1;
params.weight_trimming = 0.95;
params.acceptance = acceptance;
ccv_icf_multiscale_classifier_cascade_t* classifier = ccv_icf_classifier_cascade_new(posfiles, positive_count, bgfiles, negative_count, working_dir, params);
ccv_icf_write_classifier_cascade(classifier, working_dir);
for (i = 0; i < posfiles->rnum; i++)
Expand Down
2 changes: 1 addition & 1 deletion bin/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ include ../lib/config.mk
LDFLAGS := -L"../lib" -lccv $(LDFLAGS)
CFLAGS := -O3 -Wall -I"../lib" $(CFLAGS)

TARGETS = bbffmt msermatch siftmatch bbfcreate bbfdetect swtcreate swtdetect dpmcreate dpmdetect convert tld icfcreate icfdetect
TARGETS = bbffmt msermatch siftmatch bbfcreate bbfdetect swtcreate swtdetect dpmcreate dpmdetect convert tld icfcreate icfdetect icfoptimize

all: libccv.a $(TARGETS)

Expand Down
13 changes: 9 additions & 4 deletions lib/ccv.h
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ void ccv_array_clear(ccv_array_t* array);
void ccv_array_free_immediately(ccv_array_t* array);
void ccv_array_free(ccv_array_t* array);

#define ccv_array_get(a, i) (((char*)((a)->data)) + (a)->rsize * (i))
#define ccv_array_get(a, i) (((char*)((a)->data)) + (size_t)(a)->rsize * (size_t)(i))

typedef struct {
int x, y;
Expand Down Expand Up @@ -975,19 +975,23 @@ typedef struct {
ccv_point_t sat[CCV_ICF_SAT_MAX * 2];
float alpha[CCV_ICF_SAT_MAX];
float beta;
float weigh[2];
} ccv_icf_feature_t;

typedef struct {
int index;
float threshold;
} ccv_icf_threshold_t;

typedef struct {
ccv_icf_feature_t features[3];
float weigh[2];
} ccv_icf_decision_tree_t;

typedef struct {
int count;
ccv_size_t size;
ccv_icf_threshold_t* thresholds;
ccv_icf_feature_t* features;
ccv_icf_decision_tree_t* weak_classifier;
} ccv_icf_classifier_cascade_t;

typedef struct {
Expand Down Expand Up @@ -1015,11 +1019,12 @@ typedef struct {
double C;
double weight_trimming;
double sample_rate;
double acceptance;
} ccv_icf_new_param_t;

void ccv_icf(ccv_dense_matrix_t* a, ccv_dense_matrix_t** b, int type);
ccv_icf_multiscale_classifier_cascade_t* __attribute__((warn_unused_result)) ccv_icf_classifier_cascade_new(ccv_array_t* posfiles, int posnum, ccv_array_t* bgfiles, int negnum, const char* dir, ccv_icf_new_param_t params);
void ccv_icf_classifier_cascade_soft(ccv_icf_multiscale_classifier_cascade_t* multiscale_cascade, ccv_array_t* posfiles, int posnum, ccv_array_t* bgfiles, int negnum, const char* dir, double accept);
void ccv_icf_classifier_cascade_soft(ccv_icf_multiscale_classifier_cascade_t* multiscale_cascade, ccv_array_t* posfiles, int posnum, ccv_array_t* bgfiles, int negnum, const char* dir, ccv_icf_new_param_t params);
ccv_array_t* __attribute__((warn_unused_result)) ccv_icf_detect_objects(ccv_dense_matrix_t* a, ccv_icf_multiscale_classifier_cascade_t** multiscale_cascade, int count, ccv_icf_param_t params);
ccv_icf_multiscale_classifier_cascade_t* __attribute__((warn_unused_result)) ccv_icf_read_classifier_cascade(const char* directory);
void ccv_icf_write_classifier_cascade(ccv_icf_multiscale_classifier_cascade_t* classifier, const char* directory);
Expand Down
Loading

0 comments on commit b2c26e7

Please sign in to comment.