sudo apt update && sudo apt upgrade -y
sudo apt install -y build-essential git wget curl unzip zip python3 python3-pip python3-venv libglib2.0-0These are needed for Python, OpenCV, etc.
You confirmed you have:
Driver version: 575.64.03
CUDA version: 12.9
GPU: GeForce GTX 1060 3GB
✅ Everything looks good.
Download & install Miniconda:
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
source ~/.bashrcRestart terminal after install.
conda create -n yolov8 python=3.10 -y
conda activate yolov8pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121Test it:
python -c "import torch; print(torch.cuda.is_available())"✅ It should print True.
pip install ultralyticsyolo helpUse full absolute paths. Example:
train: /home/afraj/yolov8-dataset/train/images
val: /home/afraj/yolov8-dataset/val/images
nc: 3 # change this to your number of classes
names: ['class_0', 'class_1', 'class_2'] # replace with real class namesTo get full paths:
realpath yolov8-dataset/train/images
realpath yolov8-dataset/val/imagesRun this command (adjust batch if you get OOM):
yolo task=detect mode=train model=yolov8n.pt \
data=/home/afraj/yolov8-dataset/data.yaml \
epochs=50 imgsz=640 batch=4 name=yolov8n_runTraining outputs saved to:
📁 runs/detect/yolov8n_run/ ↳ best.pt ← this is the final model
✅ Training complete
First try direct export:
yolo export model=runs/detect/yolov8n_run/weights/best.pt format=tfliteIt will produce:
📄 best.tflite
yolo export model=runs/detect/yolov8n_run/weights/best.pt format=onnxInstall converter:
pip install onnx2tfRun:
onnx2tf -i best.onnx -o saved_modelimport tensorflow as tf
converter = tf.lite.TFLiteConverter.from_saved_model("saved_model")
converter.optimizations = [tf.lite.Optimize.DEFAULT] # optional
tflite_model = converter.convert()
with open("model.tflite", "wb") as f:
f.write(tflite_model)Now you have model.tflite 🎉
Run these two commands:
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/rThis tells Conda: “Yes, I accept the license for the default package sources.”