This guide will help you get started with MVP detector quickly.
Linux/macOS:
chmod +x install.sh
./install.shWindows:
install.bat- Create a virtual environment (optional but recommended):
python -m venv mvp_env
source mvp_env/bin/activate # Linux/macOS
# or
mvp_env\Scripts\activate.bat # Windows- Install dependencies:
pip install -r requirements.txt- Install motion vector extractor:
cd mv-extractor
pip install -e .
cd ..- Install MVP package:
pip install -e .First, you need to extract motion vectors from your videos:
# For a single video
python utils/extract_motion_vectors.py --video_path path/to/video.mp4 --output_dir path/to/mvs
# For multiple videos
python utils/extract_motion_vectors.py --video_dir path/to/videos --output_dir path/to/mvs# Single video
python src/main.py --video_path path/to/video.mp4 --mv_dir path/to/mvs/video_name --output_dir results/
# Multiple videos
python src/main.py --video_dir path/to/videos --mv_root path/to/mvs --output_root results/python evaluation/evaluate.py --pred_dir results/ --gt_dir path/to/ground_truth --output_dir evaluation_results/from src.mvp_detector import MVPDetector
# Initialize detector
detector = MVPDetector(
model_id="google/owlv2-large-patch14-ensemble",
device="cuda",
confidence_threshold=0.5
)
# Process video
stats = detector.process_video(
video_path="path/to/video.mp4",
motion_vector_dir="path/to/motion_vectors/video_name",
output_dir="path/to/output"
)
print(f"Processing completed: {stats['fps']:.2f} FPS")You can customize the detector behavior by modifying the configuration files in configs/:
default.yaml: Default configurationimagenet_vid.yaml: ImageNet VID specific configuration
Check the examples/ directory for more detailed usage examples:
basic_usage.py: Basic usage examplecustom_dataset.py: Custom dataset processingevaluation_example.py: Evaluation example
- CUDA out of memory: Reduce batch size or use CPU
- Motion vectors not found: Make sure to extract motion vectors first
- Import errors: Make sure all dependencies are installed correctly
- Check the README.md for detailed documentation
- Look at the examples in the
examples/directory - Open an issue on GitHub if you encounter problems
- Try the basic usage example
- Process your own videos
- Experiment with different configurations
- Evaluate on your dataset
- Contribute to the project!