Skip to content

Add PlantNet-300K fine-grained plant identification sample (CompiledModel GPU)#202

Open
john-rocky wants to merge 6 commits into
google-ai-edge:mainfrom
john-rocky:plantnet-plant-identification-sample
Open

Add PlantNet-300K fine-grained plant identification sample (CompiledModel GPU)#202
john-rocky wants to merge 6 commits into
google-ai-edge:mainfrom
john-rocky:plantnet-plant-identification-sample

Conversation

@john-rocky

Copy link
Copy Markdown
Contributor

PlantNet-300K (NeurIPS 2021) ResNet18 (cpoisson/plantnet300k-resnet18, Apache-2.0) — fine-grained identification of 1081 plant species, running fully on the LiteRT CompiledModel GPU at ~16 ms/frame on a Pixel 8a. The first fine-grained classifier in the samples.

Plain torchvision ResNet18 (pure CNN) → fully GPU-compatible (37/37 nodes on the delegate, 1 partition; device corr 0.99999, top-1 match) with one patch: the ResNet stem MaxPool2d(padding=1) lowers to a PADV2 with -inf padding (PADV2: src has wrong size on the Mali delegate), replaced by an explicit 0-pad + unpadded maxpool (exact since the maxpool input is post-ReLU ≥ 0). CPU-exact vs PyTorch (corr 0.99999999999).

Model: litert-community/PlantNet-300K-ResNet18-LiteRT (47 MB).

Sample at compiled_model_api/image_classification/plantnet_kotlin_gpu (android app + conversion scripts), with a deterministic bundled plant photo demo.

…odel GPU)

PlantNet-300K ResNet18 (cpoisson/plantnet300k-resnet18, Apache-2.0; NeurIPS 2021 plantnet/PlantNet-300K) — fine-grained identification of 1081 plant species, running fully on the LiteRT CompiledModel GPU at ~16 ms/frame on a Pixel 8a.

Plain torchvision ResNet18 (pure CNN) -> fully GPU-compatible (37/37 nodes on the delegate, 1 partition) with one patch: ZeroPadMaxPool (the ResNet stem maxpool's -inf PADV2 is rejected as 'PADV2: src has wrong size', replaced by an explicit 0-pad + unpadded maxpool, exact post-ReLU). CPU-exact vs PyTorch (corr 0.99999999999); device Mali GPU corr 0.99999, top-1 match.

Sample at compiled_model_api/image_classification/plantnet_kotlin_gpu (android app + conversion scripts), with a deterministic bundled plant photo demo.
@john-rocky
john-rocky force-pushed the plantnet-plant-identification-sample branch from 2141caf to 0f812c8 Compare July 6, 2026 20:58
Merge hard-wrapped lines (paragraphs, list items, blockquotes) into single lines so the markdown renders as normal prose. Tables, code blocks, and content are unchanged.
Wrap every line in the conversion scripts to the 80-column limit of the
Google Python Style Guide and add Args/Returns sections to the
module-level function docstrings. No behavior changes.
Restructure the app to the image_segmentation reference: a thin
ComponentActivity host over a MainViewModel + immutable UiState, UI strings
moved to res/values, a Gradle version catalog, and status-bar inset padding.
Inference/model code is unchanged.
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.

1 participant