improve compatibility with c++ compilers, prepare for CMake

This commit is contained in:
Stefano Sinigardi
2019-02-14 17:28:23 +01:00
parent 3d9c8530a0
commit b3579380dc
128 changed files with 1871 additions and 2258 deletions

View File

@ -12,7 +12,7 @@ void train_compare(char *cfgfile, char *weightfile)
srand(time(0));
float avg_loss = -1;
char *base = basecfg(cfgfile);
char *backup_directory = "/home/pjreddie/backup/";
char* backup_directory = "backup/";
printf("%s\n", base);
network net = parse_network_cfg(cfgfile);
if(weightfile){
@ -176,7 +176,7 @@ int bbox_comparator(const void *a, const void *b)
image im1 = load_image_color(box1.filename, net.w, net.h);
image im2 = load_image_color(box2.filename, net.w, net.h);
float *X = calloc(net.w*net.h*net.c, sizeof(float));
float* X = (float*)calloc(net.w * net.h * net.c, sizeof(float));
memcpy(X, im1.data, im1.w*im1.h*im1.c*sizeof(float));
memcpy(X+im1.w*im1.h*im1.c, im2.data, im2.w*im2.h*im2.c*sizeof(float));
float *predictions = network_predict(net, X);
@ -205,7 +205,7 @@ void bbox_fight(network net, sortable_bbox *a, sortable_bbox *b, int classes, in
{
image im1 = load_image_color(a->filename, net.w, net.h);
image im2 = load_image_color(b->filename, net.w, net.h);
float *X = calloc(net.w*net.h*net.c, sizeof(float));
float* X = (float*)calloc(net.w * net.h * net.c, sizeof(float));
memcpy(X, im1.data, im1.w*im1.h*im1.c*sizeof(float));
memcpy(X+im1.w*im1.h*im1.c, im2.data, im2.w*im2.h*im2.c*sizeof(float));
float *predictions = network_predict(net, X);
@ -239,7 +239,7 @@ void SortMaster3000(char *filename, char *weightfile)
char **paths = (char **)list_to_array(plist);
int N = plist->size;
free_list(plist);
sortable_bbox *boxes = calloc(N, sizeof(sortable_bbox));
sortable_bbox* boxes = (sortable_bbox*)calloc(N, sizeof(sortable_bbox));
printf("Sorting %d boxes...\n", N);
for(i = 0; i < N; ++i){
boxes[i].filename = paths[i];
@ -274,13 +274,13 @@ void BattleRoyaleWithCheese(char *filename, char *weightfile)
int N = plist->size;
int total = N;
free_list(plist);
sortable_bbox *boxes = calloc(N, sizeof(sortable_bbox));
sortable_bbox* boxes = (sortable_bbox*)calloc(N, sizeof(sortable_bbox));
printf("Battling %d boxes...\n", N);
for(i = 0; i < N; ++i){
boxes[i].filename = paths[i];
boxes[i].net = net;
boxes[i].classes = classes;
boxes[i].elos = calloc(classes, sizeof(float));;
boxes[i].elos = (float*)calloc(classes, sizeof(float));
for(j = 0; j < classes; ++j){
boxes[i].elos[j] = 1500;
}