Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zero Shot Instance Segmentation #57

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

jacobmarks
Copy link
Contributor

Shows how to

  1. Load Wildlife-Watcher Dataset into FiftyOne
  2. Create PNGs from MP4
  3. Run zero-shot detection with OWL-ViT
  4. Apply Ultralytics implementation of Facebook SAM with bounding box prompts
  5. Create tracks in videos in FiftyOne

Copy link
Contributor

@allenleetc allenleetc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good. Looks like this is an example showing how to sample vids, run models, and add preds to video frames. Consider using our video utils in fiftyone.utils.video if possible/appropriate.

This may be out of scope of the example but it felt like a tiny wrapup (however brief) assessment at the end touching on "how things turned out" might be nice. But that may be out of scope here.

"metadata": {},
"outputs": [],
"source": [
"dataset.ensure_frames()\n",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this ensure_frames() call isn't necessary until later; conceptually seems a bit out of place here as you are only sampling the vids here

"cell_type": "markdown",
"metadata": {},
"source": [
"Download the dataset from [this zip file](https://drive.google.com/file/d/18okj067dIOXgeHu47bsKAtaq56jRWisQ/view) to a folder `taranaki` and unzip it."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clicking this said I need to request permission, maybe note it if expected

"source": [
"We will use the following libraries:\n",
"- [FiftyOne](https://github.com/voxel51/fiftyone) to organize our dataset and visualize the results\n",
"- [transformers](https://huggingface.co/docs/transformers/index) from Hugging Face to load and run inference with [OWL-ViT](https://huggingface.co/docs/transformers/model_doc/owlvit) for zero-shot object detection\n",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably capitalize 'transformers'

"mp4_files = glob(\"taranaki/data/*\")\n",
"\n",
"### Create PNGs for each frame\n",
"for mf in mp4_files:\n",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason not to use fouv.sample_video(s), fouv.transform_video(s), etc here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe too heavy weight, but maybe another option, use to_frames() and convert/analyze video-as-frames dataset (optionally going back to video)

"outputs": [],
"source": [
"def add_sam_tracks(dataset):\n",
" for sample in dataset[100:].iter_samples(autosave=True, progress=True):\n",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this [100:]?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants