|
|
|
@ -718,7 +718,7 @@ void parserModel(FILE * xmlf, filterObject *** model, int *last, int *max, int * |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void LSVMparser(const char * filename, filterObject *** model, int *last, int *max, int **comp, float **b, int *count, float * score){ |
|
|
|
|
int LSVMparser(const char * filename, filterObject *** model, int *last, int *max, int **comp, float **b, int *count, float * score){ |
|
|
|
|
int st = 0; |
|
|
|
|
int tag; |
|
|
|
|
char ch; |
|
|
|
@ -732,7 +732,11 @@ void LSVMparser(const char * filename, filterObject *** model, int *last, int *m |
|
|
|
|
(*model) = (filterObject ** )malloc((sizeof(filterObject * )) * (*max)); |
|
|
|
|
|
|
|
|
|
//printf("parse : %s\n", filename);
|
|
|
|
|
|
|
|
|
|
xmlf = fopen(filename, "rb"); |
|
|
|
|
if(xmlf == NULL){ |
|
|
|
|
return -1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
i = 0; |
|
|
|
|
j = 0; |
|
|
|
@ -762,28 +766,31 @@ void LSVMparser(const char * filename, filterObject *** model, int *last, int *m |
|
|
|
|
} |
|
|
|
|
}
|
|
|
|
|
} |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int loadModel( |
|
|
|
|
// Âõîäíûå ïàðàìåòðû
|
|
|
|
|
const char *modelPath,// - ïóòü äî ôàéëà ñ ìîäåëüþ
|
|
|
|
|
const char *modelPath, |
|
|
|
|
|
|
|
|
|
// Âûõîäíûå ïàðàìåòðû
|
|
|
|
|
filterObject ***filters,// - ìàññèâ óêàçàòåëåé íà ôèëüòðû êîìïîíåíò
|
|
|
|
|
int *kFilters, //- îáùåå êîëè÷åñòâî ôèëüòðîâ âî âñåõ ìîäåëÿõ
|
|
|
|
|
int *kComponents, //- êîëè÷åñòâî êîìïîíåíò
|
|
|
|
|
int **kPartFilters, //- ìàññèâ, ñîäåðæàùèé êîëè÷åñòâî òî÷íûõ ôèëüòðîâ â êàæäîé êîìïîíåíòå
|
|
|
|
|
float **b, //- ìàññèâ ëèíåéíûõ ÷ëåíîâ â îöåíî÷íîé ôóíêöèè
|
|
|
|
|
float *scoreThreshold){ //- ïîðîã äëÿ score)
|
|
|
|
|
filterObject ***filters, |
|
|
|
|
int *kFilters,
|
|
|
|
|
int *kComponents,
|
|
|
|
|
int **kPartFilters,
|
|
|
|
|
float **b,
|
|
|
|
|
float *scoreThreshold){
|
|
|
|
|
int last; |
|
|
|
|
int max; |
|
|
|
|
int *comp; |
|
|
|
|
int count; |
|
|
|
|
int i; |
|
|
|
|
int err; |
|
|
|
|
float score; |
|
|
|
|
//printf("start_parse\n\n");
|
|
|
|
|
|
|
|
|
|
LSVMparser(modelPath, filters, &last, &max, &comp, b, &count, &score); |
|
|
|
|
err = LSVMparser(modelPath, filters, &last, &max, &comp, b, &count, &score); |
|
|
|
|
if(err != 0){ |
|
|
|
|
return -1; |
|
|
|
|
} |
|
|
|
|
(*kFilters) = last + 1; |
|
|
|
|
(*kComponents) = count; |
|
|
|
|
(*scoreThreshold) = (float) score; |
|
|
|
|