48 lines
849 B
C++
48 lines
849 B
C++
#include <cstdio>
|
|
#include <cstdlib>
|
|
#include <unistd.h>
|
|
|
|
#include "uNet.h"
|
|
#include "util.h"
|
|
|
|
// Global variables
|
|
int N = 1;
|
|
int random_seed = 1;
|
|
int print_max = 8;
|
|
int MAX_LEN = 10;
|
|
char *parameter_fname;
|
|
char *output_fname;
|
|
|
|
|
|
int main(int argc, char **argv) {
|
|
|
|
check_and_parse_args(argc, argv);
|
|
|
|
// Initialize model
|
|
uNet_initialize(N, random_seed, parameter_fname);
|
|
|
|
float *input = (float*)malloc(N * sizeof(float));
|
|
float *output = (float*)malloc(N * sizeof(float));
|
|
|
|
printf("running %d images...", N);
|
|
fflush(stdout);
|
|
|
|
// run uNet and measure time
|
|
double uNet_st = get_time();
|
|
|
|
uNet(input, output);
|
|
|
|
double uNet_en = get_time();
|
|
|
|
double elapsed_time = uNet_en - uNet_st;
|
|
printf("Done!\n");
|
|
|
|
// Print first few result
|
|
print_first_few_result(output, print_max, elapsed_time);
|
|
|
|
// Finalize program
|
|
uNet_finalize();
|
|
}
|
|
|
|
|