reid from https://github.com/michuanhaohao/reid-strong-baseline
554325746@qq.com
2020-03-25 b2500a8eb6665ce6efe0a7d954b6f101af83d7ec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "creid.h"
#include <stdlib.h>
#include "csrc/reid.cpp"
 
void *create_reid(const int gpu, const char *module){
    return new reid(gpu, module);
}
 
void release_reid(void *handle){
    reid *r = (reid*)handle;
    delete r;
}
 
float *extract(void *handle, unsigned char *image, const int w, const int h, const int c, int *size){
    reid *r = (reid*)handle;
    float *feat = (float*)malloc(sizeof(float) * r->feat_size());
    int ret = r->extract(image, w, h, c, feat);
    if (ret != 0){
        free(feat);
        feat = NULL;
        *size = 0;
    }
    *size = r->feat_size();
    return feat;
}
 
int feature_size(void *handle){
    reid *r = (reid*)handle;
    return r->feat_size();
}
 
float compare(void *handle, const float *feat1, const float *feat2){
    reid *r = (reid*)handle;
    return r->compare(feat1, feat2);
}