Yololite via pip install
Heya!
I posted several months back about my personal project YoloLite. I wanted to share some recent updates that have been done around my project. I have now decided to launch and upgrade directly via pip. You can test it out right now with a simple pip install yololite.This time around the models also do support instance segmentation.
Everything is still Apache 2.0 and this time around I pretrained the models on the offical COCO-minitrain 25k dataset. The weights are automatically downloaded from GitHub on demand.
You can either use the API directly via Python or run everything via the CLI:
yololite mode=predict model=yololite_cs3_m.pt source=test.jpg conf=0.4 save=True
yololite mode=train model=yololite_mnv4_s.pt data="data.yaml" epochs=30 workers=4
I have pretrained a total of 9 models across 3 different lightweight backbones:
CS3Darknet backbone:
yololite_cs3_n.pt|yololite_cs3_s.pt|yololite_cs3_m.ptMobileNetV4 backbone:
yololite_mnv4_n.pt|yololite_mnv4_s.pt|yololite_mnv4_m.ptHGNetV2 backbone:
yololite_hg2_n.pt|yololite_hg2_s.pt|yololite_hg2_m.pt
Currently supported export formats include ONNX and TensorRT. The framework also supports post-export validation to ensure stability and mAP consistency after deployment.
EXAMPLES:
from yololite import YoloLite
#Add task=“seg” to enable segmentation
model = YoloLite(r"yololite_hg2_m.pt")
#train model. Data.yaml follow yolov8 standard.
model.train(data=“data.yaml”, epochs=50, workers=4, batch=8, accumulate=4)
model.train(data=“data.yaml”, epochs=50, workers=4, batch=8, accumulate=4, task=“seg”)
#predict with the model
res = model.predict(source=“image_video_or_np.array”, conf=0.4, iou=0.6, device=“cuda”)[0]
#Export to tensorrt fp 16
engine_path_16 = model.export(format=“engine”, half=True)
#Export to tensorrt fp32
engine_path_32 = model.export(format=“engine”)
#Export to onnx (decoded)
onnx_model = model.export(format=“decoded”)
#Export onnx with built in nms
onnx_nms = model.export(format=“decoded_nms”)
#load one of the exported models
model = YoloLite(onnx_nms)
#run predict with the newly exported onnx model on a mp4 and save the results to a new mp4 file
results = model.predict(source=r"Video Project.mp4", device=“cuda”, draw=True, save=True)[0]
#evaluate exported model, summary will be saved to runs/eval
val = model.val(data=“data.yaml”, split=“test”)
NOTICE : The documentation and presentation of this project is lacking, however feel free to test the models out and decide for yourself if its fun or not. Im not claiming any SOTA titels or anythings, this is a hobby project and nothing more.
Discussion in the ATmosphere