BMW-InnovationLab / BMW-YOLOv4-Training-Automation

This repository allows you to get started with training a state-of-the-art Deep Learning model with little to no configuration needed! You provide your labeled dataset or label your dataset using our BMW-LabelTool-Lite and you can start the training right away and monitor it in many different ways like TensorBoard or a custom REST API and GUI. NoCode training with YOLOv4 and YOLOV3 has never been so easy.
BSD 3-Clause "New" or "Revised" License
640 stars 127 forks source link

training yolov4 tiny #22

Closed lidorshimoni closed 3 years ago

lidorshimoni commented 3 years ago

is it possible to train yolov4 tiny weights? I tried to train on yolo-tiny weights, specified their path in the JSON config file. like so:

    "model": {
        "framework": "darknet",
        "model_name": "yolov4",
        "custom_weights": {
            "enable": true,
            "name": "yolov4-tiny.weights"
        },

but the output files were: Screenshot from 2021-02-01 13-05-58

the initial weights are 24.3 Mb (tiny weights) and all others are 256 Mb (full wights). am I doing something wrong here?

hadikoub commented 3 years ago

When you choose custom_weights you should provide the custom weight in the dataset folder containing the images and labels ex: image

lidorshimoni commented 3 years ago

That's what I did

hadikoub commented 3 years ago

can you please send the output of the training shown in the cmd

lidorshimoni commented 3 years ago

here:

using yolo v4 version
2021-02-01 14:01:10,203 Events Log  : INFO     Creating custom trainings folder
2021-02-01 14:01:10,203 Events Log  : INFO     Checking if all data is valid
2021-02-01 14:01:10,262 Events Log  : INFO     Loading all images
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:22<00:00, 22.25s/it]
2021-02-01 14:01:32,516 Events Log  : INFO     Loading all labels
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:22<00:00, 22.59s/it]
2021-02-01 14:01:55,109 Events Log  : INFO     Creating your training folder
2021-02-01 14:01:55,110 Events Log  : INFO     Creating needed folders: weights and config
2021-02-01 14:01:55,111 Events Log  : INFO     Copying yolov4-tiny file to needed location
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 20.77it/s]
2021-02-01 14:01:55,161 Events Log  : INFO     train.txt and test.txt not found
2021-02-01 14:01:55,161 Events Log  : INFO     Creating train.txt and test.txt in needed location
2021-02-01 14:01:55,929 Events Log  : INFO     Choosing an image from test.txt for inference
2021-02-01 14:01:55,967 Events Log  : INFO     Creating .data file
2021-02-01 14:01:55,967 Events Log  : INFO     Creating .names file
2021-02-01 14:01:55,967 Events Log  : INFO     Modifying configuration file as needed
2021-02-01 14:01:55,969 Events Log  : INFO     Running web_ui on port 6007
2021-02-01 14:01:55,969 Events Log  : INFO     Running YOLO API on port 6009
2021-02-01 14:01:55,972 Events Log  : INFO     Running Tensorboard on port 6006
2021-02-01 14:01:55,974 Events Log  : INFO     Starting YOLO training

You can now monitor the training using any of the provided means or by viewing the logs saved in the custom training folder

@hadikoub

hadikoub commented 3 years ago

As shown in the output the custom weight is being copied and used. 2021-02-01 14:01:55,111 Events Log : INFO Copying yolov4-tiny file to needed location the naming of the output weights is not related to the custom_weight but related to the model_name

lidorshimoni commented 3 years ago

it's not the naming of the output weight. It's the file size.

the initial_weight is the size of a tiny weight file(24 MB) and all other files are much bigger and are normal yolo sized weights(256 MB)

Screenshot from 2021-02-01 13-05-58

if the tiny weight is being used then why its outputting normal/non-tiny weights?

@hadikoub

lidorshimoni commented 3 years ago

@hadikoub did you find any solution? or managed to reproduce the problem?

hadikoub commented 3 years ago

After I checked and tried to reproduce it, found no issue at all. The yolov4-tiny.weights are used as transfer learning weights but the repository still uses the yolov4.cfg, not yolov4-tiny.cfg. I tried to run a custom training using darknet repo with yolov4-tiny.weights and yolov4.cfg as provided in our training automation repository and the result where coherent the weights size are 245Mb image

lidorshimoni commented 3 years ago

so how I do use your tool with yolov4-tiny.cfg? I want the final weights to be in yolov4-tiny format. ?

hadikoub commented 3 years ago

you need to replace yolov4.cfg file content in ./config/darknet/yolov4_default_cfgs/yolov4.cfg with the yolov4-tiny.cfg contents and make sure that the name of the file is yolov4.cfg and then rebuild the docker image while making sure to include --no-cache in the end of docker build command

lidorshimoni commented 3 years ago

can I add multiple cfg files and choose one in the JSON file? I want to compare cfg files, like yolov4-tiny-3l and more. I tried making more cfg files and specify them in the model_name field but i got an error ConfigError: ('darknet', 'No such available framework')

modified part in JSON file:

"framework": "darknet",
"model_name": "my_yolov4",
    "custom_weights": {
hadikoub commented 3 years ago

In the meantime, you can only specify one cfg file in ./config/darknet/yolov4_default_cfgs/ and use it.

lidorshimoni commented 3 years ago

ok, thanks a lot.