Research-oriented implementation of one-shot video object segmentation built around the original OSVOS approach. The code fine-tunes a segmentation model from a single annotated frame, runs inference over a DAVIS video sequence, applies contour filling, and reports IoU-style metrics.
- TensorFlow 1.x OSVOS model definition in
osvos.py - Dataset loader and simple augmentation utilities in
dataset.py - Train-and-test orchestration in
osvos_train_test.py - End-to-end runner in
main.py - Evaluation helpers for IoU, contour accuracy, and temporal instability
- Demo scripts for parent and sequence-specific runs
The code assumes the DAVIS directory structure exists inside the repository:
DAVIS/
JPEGImages/480p/<sequence>/
Annotations/480p/<sequence>/
Results/Segmentations/480p/OSVOS/<sequence>/
It also expects pretrained checkpoints under:
models/OSVOS_parent/OSVOS_parent.ckpt-50000
main.py loops through a hard-coded list of DAVIS 2016 sequences and, for each sequence:
- Uses the first frame and first mask as the fine-tuning example.
- Fine-tunes the OSVOS model unless result masks already exist.
- Runs inference for the sequence.
- Rewrites output masks after contour filling.
- Computes mean IoU against the DAVIS annotations.
This codebase is written against the older TensorFlow 1.x API and uses tf.contrib, so it is not directly compatible with modern TensorFlow releases without porting work.
Likely requirements include:
- TensorFlow 1.x with GPU support if training on GPU
- NumPy
- OpenCV
- Pillow
- SciPy
- matplotlib
- imageio
- scikit-learn
The repository does not currently include a pinned requirements.txt.
There is no CLI wrapper. The current entrypoint is:
python main.pyYou should edit the sequence list or parameters in main.py and osvos_train_test.py if you want to run a subset of the dataset, change GPU selection, disable training, or point to different checkpoints.
main.py: sequence loop, contour post-processing, and IoU reportingosvos.py: model architecture, preprocessing, loss functions, training, and inference helpersosvos_train_test.py: per-sequence fine-tuning and evaluation wiringosvos_IoU_score.py: IoU and recall-style scoring helperscontour_score.py: contour-based accuracy and recall calculations
- Configuration is hard-coded instead of argument-driven.
- The code assumes specific filenames such as
00000.jpgand00000.pngfor one-shot fine-tuning. - The project is tied closely to DAVIS-style folder names and paths.
- Running training requires legacy TensorFlow infrastructure and matching checkpoints.
See CONTRIBUTING.md.
MIT. See LICENSE.