Skip to content

gargmegham/OneShotVideoObjectSegmentation

Repository files navigation

OSVOS

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.

What is in this repository

  • 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

Expected dataset layout

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

How the main pipeline works

main.py loops through a hard-coded list of DAVIS 2016 sequences and, for each sequence:

  1. Uses the first frame and first mask as the fine-tuning example.
  2. Fine-tunes the OSVOS model unless result masks already exist.
  3. Runs inference for the sequence.
  4. Rewrites output masks after contour filling.
  5. Computes mean IoU against the DAVIS annotations.

Environment notes

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.

Running

There is no CLI wrapper. The current entrypoint is:

python main.py

You 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.

Key files

  • main.py: sequence loop, contour post-processing, and IoU reporting
  • osvos.py: model architecture, preprocessing, loss functions, training, and inference helpers
  • osvos_train_test.py: per-sequence fine-tuning and evaluation wiring
  • osvos_IoU_score.py: IoU and recall-style scoring helpers
  • contour_score.py: contour-based accuracy and recall calculations

Limitations

  • Configuration is hard-coded instead of argument-driven.
  • The code assumes specific filenames such as 00000.jpg and 00000.png for 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.

Contributing

See CONTRIBUTING.md.

License

MIT. See LICENSE.

About

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.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages