-
Notifications
You must be signed in to change notification settings - Fork 0
TROUBLESHOOTING
This guide provides solutions to common issues encountered when using DRerio LogAI.
- Installation Issues
- Camera and Video Issues
- Detection and Tracking Issues
- Performance Issues
- GPU and Hardware Issues
- Analysis and Results Issues
- Application Errors
- Configuration Issues
Problem: poetry install command fails with dependency errors
Solutions:
-
Ensure Python 3.12 or 3.13 (3.14 is NOT supported: the pinned NumPy has no wheel for it, so the install tries to compile from source and fails):
poetry run python -V # Must report 3.12.x or 3.13.xIf it reports anything else, rebuild the environment:
poetry env use 3.12thenpoetry install. -
Update Poetry:
poetry self update
-
Clear Poetry cache:
poetry cache clear pypi --all poetry install
-
Force reinstall:
rm -rf .venv poetry install
-
Check setuptools version (must be <81):
poetry run pip list | grep setuptools # Should show setuptools < 81
Problem: ModuleNotFoundError: No module named 'zebtrack'
Solutions:
-
Run through Poetry (
poetry shellwas removed in Poetry 2.0 and moved to thepoetry-plugin-shellplugin; preferpoetry run):poetry run zebtrack
-
Verify installation:
poetry show zebtrack # Should display package info -
Reinstall in editable mode:
poetry install
Problem: ImportError: DLL load failed while importing _imaging
Solutions:
-
Install Visual C++ Redistributables:
- Download from Microsoft
- Install and restart computer
-
Reinstall Pillow:
poetry run pip uninstall Pillow poetry run pip install Pillow
-
Check Python architecture:
python -c "import struct; print(struct.calcsize('P') * 8)" # Should show 64 (not 32)
Problem: Error message "Camera ID 0 not available" or "Cannot open camera"
Step-by-Step Solutions:
- Check USB cable is fully inserted
- Try different USB port (prefer USB 3.0)
- Test camera in other applications (Zoom, Skype)
- Open Settings → Privacy & Security → Camera
- Enable "Let apps access your camera"
- Enable "Let desktop apps access your camera"
- Restart application
# Check if user is in video group
groups $USER
# Add user to video group if needed
sudo usermod -a -G video $USER
# Log out and log back in
# Check camera devices
ls -l /dev/video*- Open File → Settings
- Navigate to Camera section
- Try camera IDs: 0, 1, 2, 3
- Click Test Camera for each ID
- Open Device Manager (Win+X → Device Manager)
- Expand Cameras or Imaging devices
- Right-click camera → Update driver
- If yellow warning icon: Uninstall device → Restart computer
# Run as Administrator
Get-PnpDevice | Where-Object {$_.FriendlyName -like '*camera*'} | Disable-PnpDevice -Confirm:$false
Start-Sleep -Seconds 2
Get-PnpDevice | Where-Object {$_.FriendlyName -like '*camera*'} | Enable-PnpDevice -Confirm:$falseProblem: Error when loading video file
Solutions:
-
Check file format:
- Supported: MP4, AVI, MOV, MKV
- Use VLC or FFmpeg to verify file integrity
-
Try re-encoding:
# Using FFmpeg ffmpeg -i input.mp4 -c:v libx264 -preset medium -crf 23 output.mp4 -
Check file path:
- Avoid special characters in filename
- Avoid very long paths (>260 chars on Windows)
- Use absolute paths, not relative
-
Verify codec:
ffmpeg -i video.mp4 # Look for Video: h264 or Video: hevc -
Copy file locally:
- If on network drive, copy to local disk first
Problem: Camera opens but shows black screen or frozen image
Solutions:
-
Check camera exposure settings:
- May be auto-adjusting to lighting
- Wait 5-10 seconds for auto-exposure
-
Improve lighting:
- Ensure adequate light in environment
- Avoid pointing camera at bright light source
-
Test camera externally:
import cv2 cap = cv2.VideoCapture(0) ret, frame = cap.read() if ret: cv2.imshow('Test', frame) cv2.waitKey(0) cap.release()
-
Update camera firmware (if available from manufacturer)
-
Try different resolution:
- In settings, try lower resolution (720p instead of 1080p)
Problem: Many missed detections or false positives
Immediate Solutions:
-
Increase confidence threshold:
- Current: 0.5 → Try: 0.6 or 0.7
- In Wizard Step 4 or Settings → Detection
-
Clean environment:
- Remove debris from tank
- Clean camera lens
- Use plain background (avoid gravel, plants)
-
Improve lighting:
- Add diffuse lighting (no harsh shadows)
- Eliminate reflections and glare
- Use consistent lighting (no flickering)
-
Lower confidence threshold:
- Current: 0.5 → Try: 0.4 or 0.35
- Increases sensitivity
-
Check video quality:
- Increase resolution (720p → 1080p)
- Ensure camera is in focus
- Verify sufficient contrast (fish vs background)
-
Try different model:
- Switch YOLO ↔ OpenVINO
- Try different YOLO variant (if custom models available)
-
Calibrate camera:
- Ensure camera is perpendicular to water surface
- Minimize lens distortion (use good quality lens)
- Fix camera position (no movement)
-
Optimize video settings:
- Frame rate: 30 FPS (not too high or low)
- Bitrate: High (minimize compression)
- Codec: H.264 (good quality/size balance)
-
Subject visibility:
- Ensure fish is visually distinct from background
- Adequate size in frame (fish should be >30 pixels)
- Good contrast (dark fish on light background or vice versa)
-
Consider custom model:
- If using non-standard species, train custom model
- See
docs/MODEL_TRAINING.md(coming soon)
Problem: Subject loses track ID frequently, causing incorrect metrics
Understanding the Issue: Track ID changes (re-identification failures) occur when:
- Subjects occlude each other (multi-subject tracking)
- Subject exits and re-enters frame
- Detection gaps (subject temporarily not detected)
- Similar-looking subjects
Solutions:
-
Improve detection consistency:
- Increase confidence threshold (more reliable detections)
- Improve video quality
- Ensure continuous detection (no gaps)
-
For single-subject tracking:
- Ensure only one subject in frame
- Verify not detecting reflections or debris
- May need to manually filter tracks by duration
-
For multi-subject tracking:
- ID swaps are more common (expected behavior)
- Use track-by-track analysis (separate metrics per ID)
- Consider analyzing subjects individually if possible
-
Post-processing:
- Merge short tracks that are likely same subject
- Filter tracks by minimum duration
- Use custom scripts for track reconciliation
Problem: Analysis completes but 0 detections found
Solutions:
-
Verify model loaded:
- Check Help → System Info → Model status
- If error, reinstall model or specify model path
-
Lower confidence threshold drastically:
- Try 0.1 or 0.2 to see if any detections occur
-
Check frame extraction:
- Verify video is actually playing (not corrupted)
- Check frame count > 0 in video metadata
-
Test on sample video:
- Try analysis on known-good video (e.g., demo video)
- If works, issue is with your specific video
-
Check ROI configuration:
- If ROI is defined, ensure it covers subject location
- Try removing ROI constraints
-
Verify subject is visible:
- Manually inspect video frames
- Ensure subject is not too small (<10 pixels)
Problem: Analysis is very slow (<5 FPS)
Quick Diagnostics:
Check current performance:
- During analysis, note "Processing Speed" (FPS)
- Compare to expected: GPU 25-60 FPS, CPU 5-15 FPS
Solutions by Cause:
Check GPU status:
poetry run python -c "import torch; print(f'CUDA available: {torch.cuda.is_available()}')"If False:
-
Install CUDA Toolkit: NVIDIA CUDA Downloads
-
Install cuDNN: NVIDIA cuDNN
-
Reinstall PyTorch with CUDA:
poetry run pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118
If True but still slow:
- Check GPU memory usage:
nvidia-smi - Close other GPU applications
- Reduce batch size in settings
Solution: Reduce resolution
# In config.local.yaml
camera:
desired_width: 1280 # Down from 1920
desired_height: 720 # Down from 1080Or pre-process video:
ffmpeg -i input_4k.mp4 -vf scale=1920:1080 output_1080p.mp4Check RAM usage:
- Windows: Task Manager → Performance → Memory
- Linux:
htoporfree -h
Solutions:
- Close other applications (browsers, etc.)
- Increase virtual memory (Windows: System → Advanced → Performance Settings)
- Reduce
performance.max_parallel_videosin settings - Process shorter video segments
Solutions:
-
Use SSD instead of HDD for temporary files
-
Set temporary directory to SSD:
export TMPDIR=/path/to/ssd/tmp # Linux set TMP=D:\tmp # Windows
-
Disable real-time antivirus scanning on output directory
Solutions:
- Plug in power adapter (don't use battery)
- Check CPU throttling: Windows → Power Options → High Performance
- Ensure adequate cooling (use laptop cooling pad)
- Clean dust from vents
Problem: Application becomes unresponsive
Solutions:
-
Wait longer:
- Large videos may appear frozen but are processing
- Check CPU/GPU usage to verify activity
-
Reduce memory usage:
- Close browser, other applications
- Reduce video resolution
- Enable frame skipping
-
Update graphics drivers:
- NVIDIA: GeForce Drivers
- Intel: Intel Driver Updates
-
Disable real-time previews:
# In config.local.yaml ui_features: enable_preview_updates: false
-
Run in terminal mode (bypass GUI):
poetry run zebtrack --no-gui --video input.mp4 --output results/
Problem: System Info shows "GPU: Not Available" despite having NVIDIA GPU
Step-by-Step Fix:
# Windows: Open Device Manager
Win+X → Device Manager → Display adapters
# Should show NVIDIA GPU
# Linux:
lspci | grep -i nvidianvidia-smi
# Should display GPU info, driver version, CUDA versionIf command not found:
- Install/update NVIDIA drivers: https://www.nvidia.com/Download/index.aspx
- Restart computer after installation
nvcc --version
# Should show CUDA compiler versionIf command not found:
- Install CUDA Toolkit: https://developer.nvidia.com/cuda-downloads
- Add to PATH (installer option or manual)
poetry run python -c "import torch; print(torch.version.cuda)"
# Should show CUDA version (e.g., 11.8)If None:
-
PyTorch is CPU-only version
-
Reinstall with CUDA support:
poetry run pip uninstall torch torchvision poetry run pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118
# Fully close application
# Reopen
poetry run zebtrack
# Check Help → System InfoProblem: RuntimeError: CUDA out of memory
Solutions:
-
Reduce batch size:
# In config.local.yaml performance: detection_batch_size: 1 # Down from 4 or 8
-
Lower video resolution (see Slow Performance)
-
Close other GPU applications:
# Check GPU memory usage nvidia-smi # Kill GPU processes if needed # (use Task Manager or kill command)
-
Enable GPU memory growth (automatic in TensorFlow, manual in PyTorch):
# Advanced users: modify src/zebtrack/plugins/yolo_plugin.py import torch torch.cuda.empty_cache()
-
Use smaller model:
- YOLOv8n (nano) instead of YOLOv8l (large)
- Configure in Wizard Step 4
Problem: Arduino-based triggers not working
Solutions:
-
Verify Arduino connection:
- Check USB cable connected
- LED on Arduino should be on
- Try different USB port
-
Check COM port (Windows):
-
Device Manager → Ports (COM & LPT)
-
Note COM port number (e.g., COM3)
-
Update in config:
arduino: port: "COM3" # Adjust to your port
-
-
Check device path (Linux):
ls -l /dev/ttyUSB* /dev/ttyACM* # Note device (e.g., /dev/ttyUSB0)
arduino: port: "/dev/ttyUSB0"
-
Verify permissions (Linux):
sudo usermod -a -G dialout $USER # Log out and log back in
-
Test Arduino separately:
- Open Arduino IDE
- Upload simple sketch (Blink)
- Verify working before using with DRerio LogAI
-
Check baud rate:
arduino: baud_rate: 9600 # Match Arduino sketch
Problem: Analysis completes but expected files are missing
Solutions:
-
Check output directory:
# Look for <video_name>_results/ directory ls -la *_results/
-
Verify analysis completed successfully:
- Check for error messages in final analysis report
- Look at logs:
logs/zebtrack.log
-
Check export settings:
- Wizard Step 5: Ensure desired outputs are enabled
- "Save Annotated Video", "Generate Heatmap", etc.
-
Disk space:
# Check available space df -h . # Linux # or check Properties in Windows
-
File permissions:
# Ensure write permissions in output directory chmod -R u+w *_results/ # Linux
Problem: Cannot open Parquet file, "Invalid Parquet file" error
Solutions:
-
Verify file integrity:
import pandas as pd try: df = pd.read_parquet("file.parquet") print("File is valid") except Exception as e: print(f"Error: {e}")
-
Check file size:
ls -lh file.parquet # Should be >0 bytes- If 0 bytes: File was not written (analysis may have crashed)
-
Try recovery:
import pyarrow.parquet as pq table = pq.read_table("file.parquet") # If successful, re-export table.to_pandas().to_parquet("file_recovered.parquet")
-
Fallback to CSV (if available):
- Change export format to CSV
- Re-run analysis
Problem: Heatmap doesn't match expected movement patterns
Causes and Solutions:
-
Wrong ROI definition:
- Verify ROI covers correct area
- Check arena boundary is correct
-
Coordinate system issue:
- If using calibration, verify calibration values
- Check pixel-to-cm conversion is accurate
-
Track filtering:
-
Short, erroneous tracks may skew heatmap
-
Filter tracks by minimum duration:
df = df.groupby('track_id').filter(lambda x: len(x) > 100) # At least 100 frames
-
-
Resolution mismatch:
- Heatmap resolution should match video resolution
- Check settings:
camera.desired_width,camera.desired_height
Problem: Calculated metrics (distance, speed, time in ROI) don't match expectations
Debugging Steps:
-
Check calibration:
import pandas as pd df = pd.read_parquet("3_CoordMovimento_video.parquet") # If calibrated, x_cm and y_cm columns should exist print(df.columns) # Check scale print(df[['x_cm', 'y_cm']].describe())
-
Verify ROI definitions:
- Open
1_ArenaROI_video.parquet - Check ROI coordinates match visual expectations
- Open
-
Check for track ID swaps:
# Count unique track IDs num_tracks = df['track_id'].nunique() print(f"Number of unique tracks: {num_tracks}") # Should match number of subjects (if single subject, should be 1-2)
-
Manual validation:
- Watch annotated video alongside metrics
- Verify at least 1-2 ROI transitions manually
- Check speed calculations seem reasonable
-
Re-run analysis:
- If settings were incorrect, adjust and re-run
- Save project settings for reproducibility
Problem: Application fails to load AI model
Solutions:
-
Check model path:
# In config.local.yaml yolo_model: path: "weights/best_seg_lateral.pt" # must exist under weights/
There is no
detector:section, and there never was. The settings model forbids unknown keys, so inventing one makes the whole configuration fail validation and the application exits before opening a window. -
Download the models:
poetry run fetch-weights
This fetches the project's own trained models and verifies their checksums. Stock Ultralytics weights (
yolov8n.ptand friends) are not interchangeable with them: they do not know theaquariumandzebrafishclasses. -
Verify model format:
- YOLO:
.ptfile (PyTorch) - OpenVINO:
.xmland.binfiles
- YOLO:
-
Check model compatibility:
- Ensure model is for object detection (not classification or segmentation)
- Verify model input size matches expectations
-
Try default model:
- Remove custom model path from config
- Run
poetry run fetch-weightsto restore the published set
Problem: Cannot save files or access directories
Solutions:
- Run as Administrator (right-click → Run as Administrator)
- Check folder permissions (Properties → Security)
- Disable "Controlled folder access" (Windows Security → Virus & threat protection → Ransomware protection)
-
Check file ownership:
ls -la /path/to/file
-
Fix ownership if needed:
sudo chown -R $USER:$USER /path/to/directory
-
Fix permissions:
chmod -R u+rw /path/to/directory
Problem: Application cannot find config.yaml
Solutions:
-
Ensure in correct directory:
pwd # Should be DRerio-LogAI root directory ls config.yaml # Should exist
-
Create default config:
# Config should be created automatically # If missing, copy from repository cp config.yaml.example config.yaml
-
Specify config path:
poetry run zebtrack --config /path/to/config.yaml
Problem: Application crashes immediately on launch
Debugging:
-
Check Python version:
poetry run python -V # Must be 3.12.x or 3.13.x -
Run with verbose logging:
poetry run zebtrack --verbose --debug
-
Check logs:
cat logs/zebtrack.log # Look for last ERROR message -
Test imports:
poetry run python -c "import zebtrack; print('Success')" -
Verify dependencies:
poetry check # Verify lock file poetry show # List installed packages
-
Clean reinstall:
rm -rf .venv rm poetry.lock poetry install
Problem: Changes in settings dialog don't persist
Solutions:
-
Check for config.local.yaml:
ls -la config.local.yaml # If exists, settings are saved here -
Verify write permissions:
# Should be writable ls -la config*.yaml
-
Check for syntax errors:
# Validate YAML syntax poetry run python -c "import yaml; yaml.safe_load(open('config.local.yaml'))"
-
Manual edit:
- Open
config.local.yamlin text editor - Verify structure matches
config.yaml - Check indentation (use spaces, not tabs)
- Open
Problem: Modified settings don't change application behavior
Solutions:
-
Ensure editing correct file:
-
config.yaml: Default settings (overridden by local) -
config.local.yaml: Local overrides (takes precedence)
-
-
Restart application:
- Settings are loaded at startup
- Fully close and reopen application
-
Check setting path:
# Correct structure camera: index: 0 # Incorrect (no effect) camera_index: 0
-
Verify no typos:
- Pydantic validation will reject unknown settings
- Check logs for validation errors
-
Test with minimal config:
# Temporarily rename config.local.yaml mv config.local.yaml config.local.yaml.bak # Restart application (uses defaults) poetry run zebtrack # If works, issue is in local config
When reporting bugs, include:
-
System information:
- OS and version
- Python version (
python --version) - GPU model (if applicable)
-
Application version:
poetry run zebtrack --version
-
Error logs:
cat logs/zebtrack.log # Last 50 lines -
Steps to reproduce:
- Exact sequence of actions
- Sample video (if possible)
- Configuration files
-
Expected vs actual behavior
- GitHub Issues: https://github.com/MarkSant/DRerio-LogAI/issues
- Discussions: https://github.com/MarkSant/DRerio-LogAI/discussions
- Email: marco.sant@unesp.br
- Getting Started Guide
- FAQ
- Developer Docs:
docs/
Last Updated: November 2025 Version: 2.1