51 lines
980 B
C++
51 lines
980 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;
|
|
char *input_fname;
|
|
|
|
int main(int argc, char **argv) {
|
|
|
|
check_and_parse_args(argc, argv);
|
|
|
|
// Initialize model
|
|
uNet_initialize(N, random_seed, parameter_fname);
|
|
|
|
Tensor *input = new Tensor({1, 3, 640, 959});
|
|
Tensor *output = new Tensor({1, 2, 640, 959});
|
|
|
|
size_t input_size = 0; // byte
|
|
input->buf = (float*)read_binary(input_fname, &input_size);
|
|
|
|
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! %lf s\n", elapsed_time);
|
|
|
|
// Print first few result
|
|
// print_first_few_result(output, print_max, elapsed_time);
|
|
|
|
// Finalize program
|
|
uNet_finalize();
|
|
}
|
|
|
|
|