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

feat: update vision-camera-plugin-inatvision to a version that fully supports the geomodel #2584

Merged
merged 12 commits into from
Jan 8, 2025

Conversation

jtklein
Copy link
Collaborator

@jtklein jtklein commented Dec 24, 2024

In this PR the vision-plugin was updated (changes see below).
In the app the taxonomyRollupCutoff is removed. If no value is passed into the frame processor it uses a dynamic calculation of this value of 0.0001 times the top combined score. Combined score is equal to vision + geo scores or vision scores only if no geo scores obtained.

Changes in the vision-plugin from 4.1.4 to 4.2.0 are:

  1. A passed in location (lat, lng) is now used to look up a standardized location and elevation. For this we are using the h3, hex grid framework with the elevation around the world binned to resolution 4, from the 5 minute bioclim elevation tiff:
    https://www.worldclim.org/data/worldclim21.html
    The location used for getting geomodel scores then consists of the average elevation as well as centroid of the h3 cell the passed in location is in.
  2. Fixes a bug with geomodel scores caching on iOS. The geomodel was run for each frame. Now only when the location changes.
  3. Adds geomodel to Android.

Edit (kvangork) for tracking purposes: ML-185

@@ -134,6 +132,10 @@ const FrameProcessorCamera = ( {

const patchedOrientationAndroid = orientationPatchFrameProcessor( deviceOrientation );
const patchedRunAsync = usePatchedRunAsync( );
const hasUserLocation = !!userLocation && !!userLocation?.latitude && !!userLocation?.longitude;
const location = hasUserLocation
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TODO: Explain this

Copy link
Member

Choose a reason for hiding this comment

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

Why is this even necessary? You're only setting it when we already know the user location, so why would you ask InatVision for some other location when we already know the user's location?

src/sharedHelpers/mlModel.ts Outdated Show resolved Hide resolved
@jtklein jtklein marked this pull request as ready for review December 24, 2024 15:02
@jtklein jtklein requested a review from kueda January 7, 2025 13:28
Copy link
Member

@kueda kueda left a comment

Choose a reason for hiding this comment

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

As far as I can tell this is working fine (I can build, AICamera and Suggestions work as I would expect both online and offline). I'm not noticing an improvement in results, but I also don't have a good example of something the vision model performed poorly on without geomodel input.

My only caveat is my confusion over why we need to re-request location info from the geomodel before, which doesn't need to block.

@@ -134,6 +132,10 @@ const FrameProcessorCamera = ( {

const patchedOrientationAndroid = orientationPatchFrameProcessor( deviceOrientation );
const patchedRunAsync = usePatchedRunAsync( );
const hasUserLocation = !!userLocation && !!userLocation?.latitude && !!userLocation?.longitude;
const location = hasUserLocation
Copy link
Member

Choose a reason for hiding this comment

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

Why is this even necessary? You're only setting it when we already know the user location, so why would you ask InatVision for some other location when we already know the user's location?

@jtklein jtklein merged commit feec556 into main Jan 8, 2025
11 checks passed
@jtklein jtklein deleted the vision-plugin-geomodel-update branch January 8, 2025 15:15
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