Skip to content

Repositório dedicado ao estudo do YOLO, modelo usado no projeto para detecção de frutas (Maçã, Banana e Limão)

License

Notifications You must be signed in to change notification settings

gustavohnsv/fruit_recognition_model

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fruit Recognition Model using YOLO

  • Model made for teaching purposes, containing 4 distinguishable classes: 'apple', 'banana', 'lemon', 'person'. The last class is used to prevent the model from associating people with fruits (something that happens frequently). The fruit choices are because they are available for testing the model

  • Around 200 images were used to train each class and 50 to test them. And for model training, 50 epochs were defined for model refinement. More images and more epochs require more time and computational power

  • The files 'rec_media.py', 'rec_camera.py', 'rec_webcam.py', 'rec_screen.py' are used to test the model via a static image, via webcam, via camera on IP Webcam mobile app or screen capture, respectively

  • The files 'util_download.py' and 'util_class.py' are auxiliary files for obtaining images and manipulating classes, respectively. To download the images, the 'bing_image_downloader' library was used.

  • The "OIDv4 ToolKit" was used to obtain the images as well as their markings, in order to speed up the process. But the files to be done manually are still present in the project

Create VENV and Install Libraries

  • Create virtual enviroment
python3 -m venv dev
  • Activate
source dev/bin/activate
  • Install requirements
pip3 install -r requirements.txt

Model Params

    results = model.train(
        project=os.getenv("MODEL_PROJECT"),             # Projeto do modelo pronto
        name=os.getenv("MODEL_NAME"),                   # Nome do modelo pronto
        data=os.getenv("MODEL_DATA"),                   # Informações para o treinamento
        workers=os.getenv("MODEL_WORKERS"),             # Núcleos usados para o treinamento do modelo
        device=dev                                      # CPU/GPU dedicada para o processamento
        epochs=os.getenv("MODEL_EPOCHS"),               # Quantidade de épcoas a serem executadas pelo modelo
        augment=True,                                   # Aumento do tempo de teste
        auto_augment='augmix',                          # Política de aumento otimizando tarefas de classificação
        mosaic=1.0,                                     # Cria uma imagem composta com base em 4 outras
        mixup=0.5,                                      # Cria uma imagem composta, combinando elas aos seus rótulos
        cache='disk'                                    # Habilita ou desabilita o uso de RAM
    )

.env File

# model info
MODEL_NAME=fruit_recognition
MODEL_DATA=data_fruits.yaml
MODEL_PROJECT=../project
MODEL_WORKERS=12
MODEL_EPOCHS=50

# model to use
LAST_BEST_MODEL=../project/fruit_recognition/weights/best.pt

# specs for IP Webcam (mobile app)
IP=192.168.68.109
PORT=8080

About

Repositório dedicado ao estudo do YOLO, modelo usado no projeto para detecção de frutas (Maçã, Banana e Limão)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages