change line steps to 80% and 90% of max_batches.It is suggested that 4000 iterations are the minimum number of iterations for the model). change line max_batches to (#classes * 2000), thus 4000 iterations for our task ( Note : In case you have only one category you should not train your model for only 2000 iterations.( Note : Personally, I started with this resolution and trained my model for 4000 iterations but in order to achieve more accurate predictions I increased the resolution and continued the training process for 3000 more iterations). change the input dimensions to the default width=416, height=416.change line subdivisions to subdivisions=16 ( Note: in case Out of memory issue occurs increase this value to 32 or 64). face_mask.cfg: This configuration file has to be adjusted to our problem, namely we need to copy the yolov3.cfg rename it into _.cfg and apply the amendments as described below: These will actually be your checkpoints in case of an unexpected interruption, from where you can continue the training process.ģ. Note: In case a backup folder does not exist, create one, because there are going to be saved the weights every after 1000 iterations. data file that includes relevant information to our problem and it is going to be used from the program: classes = 2 train = data/train.txt valid = data/test.txt names = data/face_mask.names backup = backup/ Thus, for our task, we have two categories: Good and Bad based on whether someone wears her/his mask appropriately.Ģ. To simplify a little bit the task, I fused the two latter categories into one. In our case, the original Kaggle dataset has 3 categories: with_mask, without_mask, and mask_weared_incorrect. names which contains the classes of the problem. We need to create 5 files in order to complete our preparations and start training the model. But of course, they are going to get their proper values during the training phase. To use this for detection the additional weights which are present in the YOLOv3 network are randomly initialized prior to training. !wget ĭnv.74 is the backbone of the YOLOv3 network which is originally trained for classification on the ImageNet dataset and plays the role of the extractor. The next step is to clone the darknet repo by running: !git clone Īnd after that, we need to download the weights of the pre-trained model in order to apply transfer learning and not train the model from scratch. For the above example the image can be shown below: txt annotation from a given folder and displays the image with the ground truth bounding boxes. To do so, I created a script that takes an image and its corresponding. Of course, before proceeding with the training we need to be absolutely sure that the conversion was right and we are going to feed our network with valid data. ( Note: It is crucial to group into the same folder the images with their corresponding. However, to achieve that I created a script that fetches the aforementioned 5 attributes for each object in each. xml file fetch the class (namely the … field), and the coordinates of the bounding box (namely the 4 attributes in …). An example is shown below:Īssume this is the annotation of an image that contains only 3 bounding boxes (this can be seen from the number of … spans) in. txt and, more precisely, we need to create the YOLO format in order to train our model. xml annotations.Īfter we download the dataset, we need to convert the.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |