how can i load dataset for object detection from desktop to matlab for yolo training
10 次查看(过去 30 天)
显示 更早的评论
hi every.
i am facing prblem in loading darknet dataset folder into matlab. i can read images and annotation values but when i store annotation values it shows error that it should be in table i do convert to table but it nor convert in to tables.moreover i also want that it lead my labels file and display label name with annotation values or bounding vaues . my dataset look like this screanshot attached
回答(1 个)
Sachin
2023-9-13
Hi ahmad,
I understand that you want to load the dataset from the desktop for yolo training. To achieve the same kindly, refer to the following steps -
- Create a ‘mat’ file with the help of data images and annotations. Refer to the MathWorks documentation: https://in.mathworks.com/help/deeplearning/ug/object-detection-using-yolo-v2.html
- Create a Yolo object detector. Refer to the following MathWorks documentation to know more about object detection: https://in.mathworks.com/help/vision/ref/yolov2objectdetector.html
- Train your Yolo model with the help of a dataset and an object detector. To know more about training a Yolo model refer to the following documentation - https://in.mathworks.com/help/vision/ref/trainyolov2objectdetector.html#mw_1ac406b2-0df3-43b6-848e-42e7a69b79b2
- Now with the help of the ‘insertObjectAnnotation’ function, add the class label and bounding box to the result. Refer to the following documentation to know more about the ‘insertObjectAnnotation’ function - https://in.mathworks.com/help/vision/ref/insertobjectannotation.html#btilxte-1-I
Hope it help!!
Thanks
Sachin
3 个评论
Vivek Akkala
2023-9-28
Hi Ahmad,
To read the data into MATLAB and create the .mat file, you can follow these steps:
1. First, read the data into MATLAB using suitable functions such as `readtable`, `load`, or `importdata`, depending on the file format.
2. Once the data is loaded, create a table in MATLAB with two columns. Column 1 should contain the image filenames, and column 2 should contain the corresponding ground truth data. The table format is mentioned in the Object detection using YOLO v2 deep learning example.
3. If you have already created the table with the desired structure, there is no need to create a separate .mat file. You can directly use the table for training the YOLO detector. You may refer to the below steps to read the data into MATLAB:
Step 1: Get image files names use the following commands:
dataPath = 'absolute or relative path to where the files are saved';
dataFileNames = dir(fullfile(dataPath,'*.jpg'))
dataFileNames is a structure with dataFileNames.name having all the image file names.
Step 2: Read the groundtruth data using the following command:
textFileNames = dir(fullfile(dataPath,'*.txt'));
textFileNames is a structure with textFileNames.name having all the groundTruth data mentioned in the text file.
You can then extract the data from these structures and convert them into Table format.
You may further refer to following docs for more information:
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!