Run the Car
What you will learn:
How to run the autonomous car.
What you need to modify according to your own model:
Variables:
KERNEL_CONVis thenet_nameparameter incompile.sh,CONV_INPUT_NODE & CONV_OUTPUT_NODEare theinput_nodes & output_nodesinquant.sh.CUT_SIZEis the number of lines to cut in initial images(be the same inprocess_img.py).STORESIZE_WIDTH & STORESIZE_HEIGHTare the size of taken images. The final input size isSTORESIZE_WIDTH* (STORESIZE_HEIGHT-CUT_SIZE).
Functions:
setInputImage(): Replace the image preprocess with your own. Now the preprocess is:data[j*image.rows*3+k*3+i] = (float(image.at<Vec3b>(j,k)[i])/255.0 - 0.5)*scale;topKind(): It will use the results of softmax function and output the final kind, you only need it if you use classification modelrunCV(): This function is independent of DPU usage, you can add your cv control in it.If you use regression model, you don't need to use
topKind()and softmax function, you should get the model output directly and add it inaddSteer()oraddSteer_Throttleinstead ofaddCommand()and use it inrun_steer()orrun_steer_throttle()instead ofrun_command().
Output handle:
The quantity of the model output is influenced by many factors. You can adjust the output to make the car run well. For example, if the car has a tendency to turn left, you can increase the steer value to make it normal.
Run the car
cd ~/Car
make run
./init.sh # instead run: insmod /home/xilinx/dpu.ko
./build/run n 0.5 # Usage of this exe: ./car c/n 0.5(run speed)The first parameter means the run mode, n for only using neural network, c for using both neural network and computer vision functions. The second parameter is used unless the model outputs throttle value directly.
References
Last updated
Was this helpful?