## This program is for DAC HDC contest ###### ## 2017/11/22 ## [email protected] ## University of Notre Dame import procfunc import math import numpy as np import time #### !!!! you can import any package needed for your program ###### if __name__ == "__main__": teamName = 'USL-TAMU' DAC = './test2' [imgDir, resultDir, timeDir, xmlDir, myXmlDir, allTimeFile] = procfunc.setupDir(DAC, teamName) [allImageName, imageNum] = procfunc.getImageNames(imgDir) ### process all the images in batch batchNumDiskToDram = 128 ## the # of images read from disk to DRAM in one time batchNumDramToGPU = 16 ## the # of images read from DRAM to GPU in one time for batch processing on the GPU imageReadTime = math.ceil(float(imageNum)/float(batchNumDiskToDram)) imageProcTimeEachRead = math.ceil(float(batchNumDiskToDram)/float(batchNumDramToGPU)) resultRectangle = np.zeros((imageNum, 4)) ## store all the results about tracking accuracy resultRunTime = 0 if __name__=="__main__": for i in range(int(imageReadTime)): ImageDramBatch = procfunc.readImagesBatch(imgDir,allImageName, imageNum, i, batchNumDiskToDram) for j in range(int(imageProcTimeEachRead)): start = j*batchNumDramToGPU
from __future__ import print_function import os import math import time # third-party libraries import numpy as np # local packages import procfunc # set root path of the detector detector_root = '..' if __name__ == "__main__": DAC = os.path.join(detector_root, 'data') [imgDir, resultDir, timeDir, xmlDir, myXmlDir, allTimeFile] = procfunc.setupDir(DAC) # load all the images paths [allImageName, imageNum] = procfunc.getImageNames(imgDir) img_path_lst = [os.path.join(imgDir, imgName) for imgName in allImageName] ############################################## ############### detection part ############### ############################################## # initialize cfg_path = os.path.join(detector_root, 'cfg', 'valid.cfg') model_path = os.path.join(detector_root, 'model', 'yolo_tiny_dacsdc_best.weights') res_bboxes = np.zeros((imageNum, 4), dtype=int) # inference time_start = time.time()
## Folder structure: ## $DAC$| ## |images (all the test images are stored in this folder) ## |results-$teamName$| ## |time ## |xml ## !!!! Please specify your team name here teamName = 'RandomSearch' ## !!!! please specify the dir here, and please put all the images for test in the folder "images". ## Important! You can specify the folder in your local test. But for the sumission, DAC folder is fixed as follows #DAC = '/home/DACSDC_GPU' ## uncomment this line when submitting your code DAC = '/home/nvidia/DAC/DAC18-Contest-GPU-v1' # DAC = 'D:/DAC-dataset/test' [imgDir, resultDir, timeDir, xmlDir, myXmlDir, allTimeFile] = procfunc.setupDir(DAC, teamName) ############### processing for object detection and tracking ########################################################### ### load all the images names [allImageName, imageNum] = procfunc.getImageNames(imgDir) ### process all the images in batch batchNumDiskToDram = 5 ## the # of images read from disk to DRAM in one time batchNumDramToGPU = 3 ## the # of images read from DRAM to GPU in one time for batch processing on the GPU imageReadTime = int(math.ceil(imageNum / batchNumDiskToDram)) imageProcTimeEachRead = int( math.ceil(batchNumDiskToDram / batchNumDramToGPU)) resultRectangle = np.zeros( (imageNum, 4)) ## store all the results about tracking accuracy time_start = time.time()