add Colab support to the notebooks; pack config files in sam2_configs
package during installation
#176
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In this PR, we add Colab support to all the three notebooks.
They can be tested as follows from the
ronghanghu:ronghanghu/colab
branch in this PR before mergingimage_predictor_example.ipynb: https://colab.research.google.com/github/ronghanghu/segment-anything-2/blob/ronghanghu/colab/notebooks/image_predictor_example.ipynb
video_predictor_example.ipynb: https://colab.research.google.com/github/ronghanghu/segment-anything-2/blob/ronghanghu/colab/notebooks/video_predictor_example.ipynb
automatic_mask_generator_example.ipynb: https://colab.research.google.com/github/ronghanghu/segment-anything-2/blob/ronghanghu/colab/notebooks/automatic_mask_generator_example.ipynb
(to test them before merging, set
using_colab = True
and replacegit+https://github.com/facebookresearch/segment-anything-2.git
withgit+https://github.com/ronghanghu/segment-anything-2.git@ronghanghu/colab
in the Colab environment setup cell.)Besides, we also add the following lines
to
setup
insetup.py
to copy over the SAM 2 config YAML files into thesam2_configs
packages after installation (see https://stackoverflow.com/questions/1612733/including-non-python-files-with-setup-py), which should resolve #51.All 3 notebooks tested in Colab and work well. Example running
image_predictor_example.ipynb
in Colab (using L4 GPU):