Fixing YOLOv8 Camera Lag on Low-End Laptops for Live FYP Demos
Your YOLOv8 FYP demo runs at 2-3 FPS on your laptop, the webcam feed stutters, and the external examiner is watching. On the 8GB RAM, integrated-graphics laptops most students in Pakistan actually own, this is the defaul
Your YOLOv8 FYP demo runs at 2-3 FPS on your laptop, the webcam feed stutters, and the external examiner is watching. On the 8GB RAM, integrated-graphics laptops most students in Pakistan actually own, this is the default experience — not a broken project. The model is fine. Your pipeline settings are wrong for the hardware.
Here is the order to fix it in, from biggest gain to smallest.
1. Drop the input size first
results = model(frame, imgsz=320)
Default is 640. Dropping to 320 cuts the work per frame roughly by 4x and is the single biggest FPS gain. For demo objects at desk distance (faces, vehicles on a model road, products), 320 is usually still accurate enough. Test 416 as a middle ground if detection suffers.
2. Use the nano model for the live demo
yolo export model=yolov8n.pt format=onnx
If your report says YOLOv8, it does not have to say YOLOv8m. Train and validate on the size you want for your results chapter, but run the live demo on yolov8n (nano) exported to ONNX. On CPU-only laptops this is often the difference between unusable and smooth.
3. Stop processing every frame
frame_count = 0
while True:
ret, frame = cap.read()
if not ret:
break
frame_count += 1
if frame_count % 3 != 0:
cv2.imshow("Demo", last_annotated)
continue
results = model(frame, imgsz=320, verbose=False)
last_annotated = results[0].plot()
cv2.imshow("Demo", last_annotated)
Detecting on every 3rd frame triples your effective smoothness for tracking-style demos, and the drawn boxes stay believable between detections.
4. Shrink the camera feed itself
cap = cv2.VideoCapture(0)
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480)
Many laptop webcams default to 1080p. You are resizing that down inside the model anyway — capture smaller and save the CPU the resize work.
5. Turn off the extras during the demo
- verbose=False on every call (logging costs more than you think)
- Close Chrome and other heavy apps before the demo
- Plug the laptop in — Windows power saving throttles the CPU on battery, and university lab power strips are there for a reason
What to say when the examiner asks about FPS
Do not apologise for the hardware. Say: "The system runs the nano model at 320 input size for the live demo, which gives us [measured] FPS on a standard laptop without a GPU. The full model can be run offline where accuracy matters more than speed." That answer shows an engineering trade-off, which is exactly what the question is testing. Measure your real FPS after these fixes and write that number in your report — do not copy anyone else's.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.