MCPcopy Create free account
hub / github.com/Xilinx/CHaiDNN / inputNormalization

Function inputNormalization

software/interface/xi_readwrite_util.cpp:599–692  ·  view source on GitHub ↗

Input Read

Source from the content-addressed store, hash-verified

597
598//# Input Read
599int inputNormalization(std::vector<void *>input, int resize_h, int resize_w,
600 char *img_path1, char *img_path2, bool inp_mode,
601 float *mean_ptr, float *var_ptr,
602 int numImg_to_process, io_layer_info io_layer_info_ptr)
603{
604
605 //# use for Pixel wise mean subtraction
606 //# Currently support is disabled
607 char *mean_path;
608
609 //# Load input layer params
610 int inp_height = io_layer_info_ptr.in_height;
611 int inp_width = io_layer_info_ptr.in_width;
612 int inp_bw = io_layer_info_ptr.in_bw;
613 int inp_fbits = io_layer_info_ptr.in_fbits;
614 int inp_channel = io_layer_info_ptr.in_channel;
615 int inp_depth = io_layer_info_ptr.in_depth;
616 float th_in = io_layer_info_ptr.th_in;
617 int quant_scheme_flag = io_layer_info_ptr.quant_scheme_flag;
618
619 int en_batch_size_one;
620
621 if(numImg_to_process == 2)
622 en_batch_size_one = 0;
623 else
624 en_batch_size_one = 1;
625
626 int normalize_enable=inp_mode;
627 int status;
628
629 if((resize_h < inp_height) || (resize_w < inp_width))
630 {
631 fprintf(stderr,"[ERROR] invalid resize params\n");
632 return -1;
633 }
634
635 int batch_loop_cnt;
636 if(en_batch_size_one)
637 batch_loop_cnt = 1;
638 else
639 batch_loop_cnt = XBATCH_SIZE;
640
641 if(inp_mode==0)
642 {
643 for(int batch_id = 0; batch_id < batch_loop_cnt; batch_id++)
644 {
645 if (batch_id == 0)
646 {
647 status = loadPlaneMeanSubtractedDatatoBuffptr(img_path1, (IO_DATA_TYPE *)input[batch_id],
648 mean_ptr, inp_height, inp_width, inp_channel, resize_h, resize_w, inp_fbits, inp_bw, th_in, quant_scheme_flag);
649 }
650 else
651 {
652 status = loadPlaneMeanSubtractedDatatoBuffptr(img_path2, (IO_DATA_TYPE *)input[batch_id], mean_ptr, inp_height, inp_width, inp_channel, resize_h, resize_w, inp_fbits, inp_bw, th_in, quant_scheme_flag);
653 }
654 }
655 }
656

Callers 7

mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85

Tested by

no test coverage detected