-
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 virtual enviroment
python3 -m venv dev- Activate
source dev/bin/activate- Install requirements
pip3 install -r requirements.txt 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
)# 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