Skip to content

Commit 9477436

Browse files
authored
Add files
Add the files of this project.
1 parent 8b8aa09 commit 9477436

9 files changed

+130
-2
lines changed

README.md

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,53 @@
1-
# Cone-Detection-Using-Deep-Learning-for-Formula-Student-Driverless
2-
This project presents a complete workflow for cone detection in Formula Student Driverless scenarios using deep learning.
1+
# Cone Detection Using Deep Learning for Formula Student Driverless
2+
<!-- This is the "Title of the contribution" that was approved during the Community Contribution Review Process -->
3+
4+
[![Open in MATLAB Online](https://www.mathworks.com/images/responsive/global/open-in-matlab-online.svg)](https://matlab.mathworks.com/open/github/v1?repo=matlab-deep-learning/Cone-Detection-Using-Deep-Learning-for-Formula-Student-Driverless)
5+
<!-- Add the "File Exchange" icon to the README if this repo also appears on File Exchange via the "Connect to GitHub" feature -->
6+
<!-- Add the "Open in MATLAB Online" icon to the README to open a particular file on MATLAB Online -->
7+
8+
This project presents a complete workflow for cone detection in Formula Student Driverless scenarios using deep learning. It demonstrates how to use MATLAB® and Simulink® for data preparation and labeling, YOLOX neural network design and training, and deployment to a GPU for real-time inference. We gratefully acknowledge the DIAN Racing Team at Tongji University, China, for providing the video datasets used in this demonstration.
9+
10+
![ss](snapshot.png)
11+
12+
<!--- Please remember to delete all template related text that you are not using within your README.md --->
13+
14+
## Installation
15+
This project has been tested on MATLAB® release R2024b and R2025a. Before getting started, ensure that the below MathWorks Products and Support Packages are installed and configured correctly in MATLAB®:
16+
### MathWorks Products
17+
* [Image Processing Toolbox™](https://www.mathworks.com/products/image-processing.html)
18+
* [Computer Vision Toolbox™](https://www.mathworks.com/products/computer-vision.html)
19+
* [Deep Learning Toolbox™](https://www.mathworks.com/products/deep-learning.html)
20+
* [Parallel Computing Toolbox™](https://www.mathworks.com/products/parallel-computing.html)
21+
* [MATLAB Coder™](https://www.mathworks.com/products/matlab-coder.html)
22+
* [GPU Coder™](https://www.mathworks.com/products/gpu-coder.html)
23+
### Support Packages
24+
* [The Computer Vision Toolbox™ Automated Visual Inspection Library](https://www.mathworks.com/matlabcentral/fileexchange/116555-automated-visual-inspection-library-for-computer-vision-toolbox)
25+
* [MATLAB Coder Support Package for NVIDIA Jetson and NVIDIA DRIVE Platforms](https://www.mathworks.com/matlabcentral/fileexchange/68644-matlab-coder-support-package-for-nvidia-jetson-and-nvidia-drive-platforms)
26+
27+
Please see the [Setup and Configuration](https://www.mathworks.com/help/coder/setup-and-configuration.html) for detailed setup and configuration instructions of the [MATLAB Coder Support Package for NVIDIA Jetson and NVIDIA DRIVE Platforms](https://www.mathworks.com/matlabcentral/fileexchange/68644-matlab-coder-support-package-for-nvidia-jetson-and-nvidia-drive-platforms) .
28+
<!--- Make sure you have a Installation.md document in the Documentation folder if you are to follow this formatting. You can choose your own folder formatting if you prefer --->
29+
30+
31+
## Getting Started
32+
Information about Getting Started
33+
<!--- List or link to any relevent Documentation to help the user Get Started --->
34+
* Open the `coneDetectionWithYOLOX.mlx` live script in MATLAB®, and run the code section-by-section to understand the workflow. **Please note:** In Step 7, do not forget to change the NVIDIA Jetson™ GPU settings to your own, and also change the video name *vidName* in the `coneDetection.m` to the file location of your own test video.
35+
* Open the `coneDetectionWithObjectDetectorBlock.slx` in Simulink® and update the **File name** of the "From Multimedia File" block and the **File path** of the "Deep learning Object Detector" block to your own file name or path.
36+
37+
## License
38+
<!--- Make sure you have a License.txt within your Repo --->
39+
40+
The license is available in the `License.txt` file in this GitHub repository.
41+
42+
## Community Support
43+
[MATLAB Central](https://www.mathworks.com/matlabcentral)
44+
45+
Copyright 2025 The MathWorks, Inc.
46+
47+
<!--- Do not forget to the add the SECURITY.md to this repo --->
48+
<!--- Add Topics #Topics to your Repo such as #MATLAB --->
49+
50+
<!--- This is my comment --->
51+
52+
<!-- Include any Trademarks if this is the first time mentioning trademarked products (For Example: MATLAB&reg; Simulink&reg; Trademark&trade; Simulink Test&#8482;) -->
53+

SECURITY.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Reporting Security Vulnerabilities
2+
3+
If you believe you have discovered a security vulnerability, please report it to
4+
[[email protected]](mailto:[email protected]). Please see
5+
[MathWorks Vulnerability Disclosure Policy for Security Researchers](https://www.mathworks.com/company/aboutus/policies_statements/vulnerability-disclosure-policy.html)
6+
for additional information.

coneDetection.m

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
function coneDetection() %#codegen
2+
persistent model;
3+
% Load model
4+
if isempty(model)
5+
model = coder.loadDeepLearningNetwork('yoloxConeDetector.mat');
6+
end
7+
8+
% Create Jetson hardware object
9+
hwobj = jetson();
10+
11+
% Please use your own video file with a frame size of 416x416
12+
vidName = '/home/xavier/Videos/testConeDetector_416x416.mp4';
13+
14+
% Create video reader object,
15+
vObj = VideoReader(hwobj,vidName,width= 416, height = 416);
16+
17+
% Create display object on the target
18+
dispObj = imageDisplay(hwobj);
19+
20+
while vObj.hasFrame
21+
% Grab a frame from the video pipeline
22+
img = vObj.readFrame();
23+
24+
% Cone detection in the frame
25+
[bboxes, ~, labels] = model.detect(img,'Threshold',0.5);
26+
27+
% Annotate detections in the frame.
28+
if ~isempty(bboxes)
29+
outImg = insertObjectAnnotation(img,'Rectangle', ...
30+
bboxes, cellstr(labels));
31+
else
32+
outImg = img;
33+
end
34+
35+
% Adjust the direction of the frame for output
36+
displayImg = cat(3, outImg(:,:,1).', ...
37+
outImg(:,:,2)',outImg(:,:,3)');
38+
39+
% Display the frame
40+
image(dispObj,displayImg);
41+
end
42+
end
43+
44+
% Copyright 2025 The MathWorks, Inc.
43.8 KB
Binary file not shown.

coneDetectionWithYOLOX.mlx

74.6 KB
Binary file not shown.

gTruthCones.mat

19.2 KB
Binary file not shown.

license.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright (c) 2025, The MathWorks, Inc.
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are
6+
met:
7+
8+
* Redistributions of source code must retain the above copyright
9+
notice, this list of conditions and the following disclaimer.
10+
* Redistributions in binary form must reproduce the above copyright
11+
notice, this list of conditions and the following disclaimer in
12+
the documentation and/or other materials provided with the distribution
13+
* Neither the name of the The MathWorks, Inc. nor the names
14+
of its contributors may be used to endorse or promote products derived
15+
from this software without specific prior written permission.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27+
POSSIBILITY OF SUCH DAMAGE.

snapshot.png

348 KB
Loading

yoloxConeDetector.mat

18.1 MB
Binary file not shown.

0 commit comments

Comments
 (0)