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

A plot_results function that works across predict* functions and multiple annotation types. #768

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

bw4sz
Copy link
Collaborator

@bw4sz bw4sz commented Sep 4, 2024

Quick roadmap for a number of visualization related issues.

  • Create a single plot_results function that can take in points, boxes and polygons and plots them using supervision package, optionally saving a plot, and shows the image
  • Confirm no backwards compatibility changes in plot_predictions
  • Update docs to only use plot_results where possible.
  • Make a decision on Consider decoupling plotting from predict_* functions #761 and close.

@bw4sz bw4sz changed the title [WIP] created structure for general viz function Created structure for general viz function Sep 10, 2024
@bw4sz
Copy link
Collaborator Author

bw4sz commented Sep 10, 2024

@ethanwhite this is ready for review. There is one backwards compatibility error. Within the predict_* functions, there is no longer a return_plot argument. This seemed cleaner than adding a deprecation.

@bw4sz
Copy link
Collaborator Author

bw4sz commented Sep 10, 2024

Quick demo is within the doc build see docs/advanced_features/visuzalization.md in the readthedoc build

https://deepforest--768.org.readthedocs.build/en/768/advanced_features/visualizations.html

from deepforest import main, get_data
from deepforest.visualize import plot_results
import os

model = main.deepforest()
model.use_release()

sample_image_path = get_data("OSBS_029.png")
results = model.predict_image(path=sample_image_path)
plot_results(results, root_dir=os.path.dirname(sample_image_path))

@bw4sz bw4sz changed the title Created structure for general viz function A plot_results function that works across predict* functions and multiple annotation types. Sep 10, 2024
@bw4sz
Copy link
Collaborator Author

bw4sz commented Sep 11, 2024

Add root_dir as a class attribute of a prediction dataframe through pandas. Remove the root_dir argument from plot_results.

@bw4sz
Copy link
Collaborator Author

bw4sz commented Sep 11, 2024

Make the visualizations larger. on the markdown document.

deepforest/visualize.py Outdated Show resolved Hide resolved
docs/advanced_features/visualizations.md Outdated Show resolved Hide resolved
docs/data_annotation/annotation.md Outdated Show resolved Hide resolved
docs/getting_started/getting_started.md Outdated Show resolved Hide resolved
docs/getting_started/getting_started.md Show resolved Hide resolved
Copy link
Member

@ethanwhite ethanwhite left a comment

Choose a reason for hiding this comment

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

Really excellent work @bw4sz and a lot of it. I've done my best to review the whole thing thoroughly. Almost all of the comments are minor cleanup, with the one slightly more major thing being a small change to how multi-class colors are handled. Let me know if you have any questions.

deepforest/main.py Outdated Show resolved Hide resolved
deepforest/main.py Outdated Show resolved Hide resolved
deepforest/main.py Outdated Show resolved Hide resolved
deepforest/main.py Outdated Show resolved Hide resolved
deepforest/main.py Show resolved Hide resolved
docs/getting_started/getting_started.md Outdated Show resolved Hide resolved
tests/test_main.py Outdated Show resolved Hide resolved
tests/test_main.py Outdated Show resolved Hide resolved
tests/test_main.py Outdated Show resolved Hide resolved
tests/test_main.py Outdated Show resolved Hide resolved
@ethanwhite
Copy link
Member

@bw4sz - is this ready for me to give it another look?

@bw4sz
Copy link
Collaborator Author

bw4sz commented Sep 19, 2024 via email

@bw4sz
Copy link
Collaborator Author

bw4sz commented Sep 19, 2024

@ethanwhite I rebased and this should be ready.

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