Skip to content

point model training support#1396

Open
jveitchmichaelis wants to merge 1 commit into
weecology:mainfrom
jveitchmichaelis:treeformer-training
Open

point model training support#1396
jveitchmichaelis wants to merge 1 commit into
weecology:mainfrom
jveitchmichaelis:treeformer-training

Conversation

@jveitchmichaelis
Copy link
Copy Markdown
Collaborator

@jveitchmichaelis jveitchmichaelis commented Jun 1, 2026

Description

This PR adds training functionality for the default point model. Most of the code has been distilled from my experimental branch. It should replicate the existing checkpoint, and I'm running a quick test to make sure.

Changes are relatively small in scope - added the optimal transport loss code, fleshed out compute_losses for the model and fixed a small bug in point visualization where the VertexAnnotator wouldn't accept a palette (we instead convert points to "detections" with a radius and plot them as circles).

I've included a point_pretrain config which was used to train the current default point model on NEON data, replication should be possible with:

uv deepforest --config-name point_pretrain train

Related Issue(s)

Closes #809 as we now support training, visualization of predictions, simple unit tests + should also include multi-class support in theory but we've not tested it.

AI-Assisted Development

Claude code for assistance with merging the changes from the other branch.

  • I used AI tools (e.g., GitHub Copilot, ChatGPT, etc.) in developing this PR
  • I understand all the code I'm submitting
  • I have reviewed and validated all AI-generated code

@jveitchmichaelis jveitchmichaelis force-pushed the treeformer-training branch 2 times, most recently from 8f7359f to 17bff61 Compare June 1, 2026 13:41
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 1, 2026

Codecov Report

❌ Patch coverage is 92.96875% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.05%. Comparing base (d2851ec) to head (e538222).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
src/deepforest/losses/ot_loss.py 93.75% 7 Missing ⚠️
src/deepforest/models/treeformer.py 94.30% 7 Missing ⚠️
src/deepforest/main.py 42.85% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1396      +/-   ##
==========================================
+ Coverage   86.61%   87.05%   +0.43%     
==========================================
  Files          26       27       +1     
  Lines        3736     3977     +241     
==========================================
+ Hits         3236     3462     +226     
- Misses        500      515      +15     
Flag Coverage Δ
unittests 87.05% <92.96%> (+0.43%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jveitchmichaelis jveitchmichaelis marked this pull request as ready for review June 1, 2026 20:00
@jveitchmichaelis jveitchmichaelis requested a review from bw4sz June 1, 2026 20:00
@jveitchmichaelis
Copy link
Copy Markdown
Collaborator Author

This looks good enough for review. I’ll run some more extensive tests to see if there’s any other features that need to be pulled in, but the core losses are all here.

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.

Point detection workflow

1 participant