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

Add a plotting code snippet for predict_tile to getting_started page. #570

Closed
wants to merge 4 commits into from

Conversation

bw4sz
Copy link
Collaborator

@bw4sz bw4sz commented Dec 8, 2023

Everytime a user is confused about something I try to make some changes to the docs.

In

#566

user tried to do

# Perform prediction on the tile
result = model.predict_tile(raster_path, return_plot=True, patch_size=patch_size, patch_overlap=patch_overlap)

# Extract the predicted raster and boxes from the result
predicted_raster = result[0]
predicted_boxes = result[1]

# Load the original image for visualization
original_image = plt.imread(raster_path)

# Display the original image
plt.imshow(original_image)

# Plot the predicted bounding boxes on the original image
for _, box in predicted_boxes.iterrows():
    xmin, ymin, xmax, ymax = box["xmin"], box["ymin"], box["xmax"], box["ymax"]
    rect = plt.Rectangle((xmin, ymin), xmax - xmin, ymax - ymin, linewidth=1, edgecolor="r", facecolor="none")
    plt.gca().add_patch(rect)

So I made it clearer in getting started that just the image is return in predict_tile(return_plot=True), and we can call matplotlib directly.

@bw4sz bw4sz requested a review from ethanwhite December 8, 2023 00:16
@bw4sz bw4sz self-assigned this Dec 8, 2023
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.

Looks like there's a bunch of extra history in here? Can you clean up it and then I'll give it a read quick read and get it in.

@bw4sz bw4sz mentioned this pull request Dec 11, 2023
@bw4sz
Copy link
Collaborator Author

bw4sz commented Dec 11, 2023

Closed for a new clean PR #573

@bw4sz bw4sz closed this Dec 11, 2023
ethanwhite added a commit that referenced this pull request Dec 11, 2023
@bw4sz bw4sz deleted the getting_started branch February 22, 2024 14:07
janjatovic pushed a commit to Treeconomy/DeepForest_new that referenced this pull request Mar 26, 2024
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