Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Minor FiftyOne integration tweaks #418

Merged

Conversation

ehofesmann
Copy link
Contributor

What does this PR do?

This PR adds a couple small tweaks to the FiftyOne integration, primarily to the documentation:

Here's the content of the new README section (all Flash code)

Visualization

Predictions from image and video tasks can be visualized through an integration with FiftyOne, allowing you to better understand and analyze how your model is performing.

from flash.core.data.utils import download_data
from flash.core.integrations.fiftyone import visualize
from flash.image import ObjectDetector
from flash.image.detection.serialization import FiftyOneDetectionLabels

# 1. Download the data
# Dataset Credit: https://www.kaggle.com/ultralytics/coco128
download_data(
    "https://github.com/zhiqwang/yolov5-rt-stack/releases/download/v0.3.0/coco128.zip",
    "data/",
)

# 2. Load the model from a checkpoint and use the FiftyOne serializer
model = ObjectDetector.load_from_checkpoint(
    "https://flash-weights.s3.amazonaws.com/object_detection_model.pt"
)
model.serializer = FiftyOneDetectionLabels()

# 3. Detect the object on the images
filepaths = [
    "data/coco128/images/train2017/000000000025.jpg",
    "data/coco128/images/train2017/000000000520.jpg",
    "data/coco128/images/train2017/000000000532.jpg",
]
predictions = model.predict(filepaths)

# 4. Visualize predictions in FiftyOne App
session = visualize(predictions, filepaths=filepaths)

Before submitting

  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests? [not needed for typos/docs]
  • Did you verify new and existing tests pass locally with your changes?
  • If you made a notable change (that affects users), did you update the CHANGELOG?

PR review

  • Is this pull request ready for review? (if not, please submit in draft mode)

Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.

Did you have fun?

Make sure you had fun coding 🙃

@codecov
Copy link

codecov bot commented Jun 16, 2021

Codecov Report

Merging #418 (4438bcc) into master (146e05d) will decrease coverage by 0.01%.
The diff coverage is 12.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #418      +/-   ##
==========================================
- Coverage   90.08%   90.07%   -0.02%     
==========================================
  Files         112      112              
  Lines        6999     7000       +1     
==========================================
  Hits         6305     6305              
- Misses        694      695       +1     
Flag Coverage Δ
unittests 90.07% <12.50%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
flash/core/integrations/fiftyone/utils.py 47.22% <0.00%> (-1.35%) ⬇️
flash/image/segmentation/serialization.py 88.88% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 146e05d...4438bcc. Read the comment docs.

@ehofesmann ehofesmann marked this pull request as ready for review June 16, 2021 15:13
Copy link
Collaborator

@ethanwharris ethanwharris left a comment

Choose a reason for hiding this comment

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

@ehofesmann Nice! I've updated the embeddings image. Other than that just minor comments

flash/core/integrations/fiftyone/utils.py Outdated Show resolved Hide resolved
flash/core/integrations/fiftyone/utils.py Outdated Show resolved Hide resolved
flash/core/integrations/fiftyone/utils.py Outdated Show resolved Hide resolved
flash/core/integrations/fiftyone/utils.py Outdated Show resolved Hide resolved
flash/core/integrations/fiftyone/utils.py Outdated Show resolved Hide resolved
flash/core/integrations/fiftyone/utils.py Outdated Show resolved Hide resolved
flash/image/segmentation/serialization.py Outdated Show resolved Hide resolved
ehofesmann and others added 2 commits June 16, 2021 12:34
Co-authored-by: Ethan Harris <[email protected]>
Co-authored-by: Ethan Harris <[email protected]>
@ehofesmann
Copy link
Contributor Author

@ehofesmann Nice! I've updated the embeddings image. Other than that just minor comments

Awesome, thanks a lot!

@ethanwharris
Copy link
Collaborator

@ehofesmann We've been getting this error quite a bit today on docs builds:

intersphinx inventory 'https://voxel51.com/docs/fiftyone/objects.inv' not fetchable due to <class 'requests.exceptions.ConnectionError'>: HTTPSConnectionPool(host='voxel51.com', port=443): Max retries exceeded with url: /docs/fiftyone/objects.inv (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7eff1a6bb1d0>: Failed to establish a new connection: [Errno 110] Connection timed out'))

It usually is fine if I just re-trigger the build, but that's not really sustainable. Do you have any idea what might be causing the issue?

@ehofesmann
Copy link
Contributor Author

@ehofesmann We've been getting this error quite a bit today on docs builds:

intersphinx inventory 'https://voxel51.com/docs/fiftyone/objects.inv' not fetchable due to <class 'requests.exceptions.ConnectionError'>: HTTPSConnectionPool(host='voxel51.com', port=443): Max retries exceeded with url: /docs/fiftyone/objects.inv (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7eff1a6bb1d0>: Failed to establish a new connection: [Errno 110] Connection timed out'))

It usually is fine if I just re-trigger the build, but that's not really sustainable. Do you have any idea what might be causing the issue?

We've spent some time looking into this and haven't been able to reproduce those issues locally or in our own fork's actions. We did push website updates yesterday and it is possible that our hosting provider may have a hiccup today. Let me know if this keeps showing up and we will continue to investigate it.

@ethanwharris
Copy link
Collaborator

@ehofesmann cool, will do, thanks for investigating 😃

@ethanwharris ethanwharris merged commit 113efab into Lightning-Universe:master Jun 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants