Skip to main content

A fork of the STCN video object segmentation model.

Project description

Buffered STCN for Online and Offline Segmentation of Long Videos

This is a fork of the STCN video object segmentation method. It is optimized for online prediction for long videos. That is, feeding a video stream to the network frame-by-frame and obtaining the predictions for each frame immediately. By contrast, the original repository only allows batch processing where the whole video needs to be loaded first and the result is given for the whole sequence at once.

To avoid running out of memory in case of long videos, I extended STCN with a buffer mechanism. Once the memory bank buffer reaches a specified number of frames, each new insertion replaces a random existing element in the buffer. This randomization results in an exponentially distributed sample, favoring recent time steps.

For offline use, permuting the frames randomly and performing a burn-in pass (or several) achieves better segmentation quality. This way the memory will contain samples from the whole video sequence, which helps if the subject undergoes some appearance changes, such as lighting change, clothing change, distance or zoom, turning around, etc. The final pass can be done in order, keeping the previous few frames also in the memory in addition to the burn-in result.

For initializing the segmentation, the intial timestamp can be provided; otherwise the middle frame is used. Mask-RCNN is run on this frame and then either the user can click the subjects to track using a GUI, or the highest-scoring detections are used.


The code has been refactored in many other aspects as well, including removing einops usage in order to support TorchScript compilation.

References

Original STCN:

Ho Kei Cheng, Yu-Wing Tai, Chi-Keung Tang. Rethinking Space-Time Networks with Improved Memory Coverage for Efficient Video Object Segmentation. In Advances in Neural Information Processing Systems (NeurIPS), 2021.

https://github.com/hkchengrex/STCN

@inproceedings{cheng2021stcn,
  title={Rethinking Space-Time Networks with Improved Memory Coverage for Efficient Video Object Segmentation},
  author={Cheng, Ho Kei and Tai, Yu-Wing and Tang, Chi-Keung},
  booktitle={NeurIPS},
  year={2021}
}

@inproceedings{cheng2021mivos,
  title={Modular Interactive Video Object Segmentation: Interaction-to-Mask, Propagation and Difference-Aware Fusion},
  author={Cheng, Ho Kei and Tai, Yu-Wing and Tang, Chi-Keung},
  booktitle={CVPR},
  year={2021}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stcnbuf-0.2.1.tar.gz (20.7 kB view details)

Uploaded Source

File details

Details for the file stcnbuf-0.2.1.tar.gz.

File metadata

  • Download URL: stcnbuf-0.2.1.tar.gz
  • Upload date:
  • Size: 20.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for stcnbuf-0.2.1.tar.gz
Algorithm Hash digest
SHA256 f21438d2451055e431a7c652a6927ed575ceac1cbfa833db8e8fcf72402683a4
MD5 93ebe4b1ffa88c3a74e117617fef508b
BLAKE2b-256 72d1f486fb7a77703f6e98d8cfc27e4c298264c6219c48bdc26804d87f41e362

See more details on using hashes here.

Provenance

The following attestation bundles were made for stcnbuf-0.2.1.tar.gz:

Publisher: python-publish.yml on isarandi/stcnbuf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page