How to download taxa

When running the model on our own app, how do we find the taxon_name given the taxon_id? Is there a way to download the taxon database, with names indexed by id?

This will be more authoritatively answered by a developer, but maybe I can help get you started.

Check out the API reference for “get taxa ID” . https://api.inaturalist.org/v1/docs/#/Taxa

As an example if you know the taxon ID is 64350. You can get a taxon results page for this ID using this API string:

https://api.inaturalist.org/v1/taxa/64350

Within the results returned you will find the common name in the “preferred_common_name” slot and you the latin name in the “name” slot.

Does that help?

2 Likes

This is helpful, thank you. Is there any way to download the taxon_id and taxon_name table itself? Am looking to id and label in realtime, so calls out over the WAN would greatly slow the response.

I don’t know how to do this. Maybe one of the developers (@tiwane?) can tell you.

You could download all the taxon information through the route I described above, parse it yourself and then save a table with the information you want. Keep in mind there are hundreds of thousands of taxon_ids (at least). Also taxa ID and names change over time as curators add taxa, split taxa, swap taxa and lump taxa depending on the taxonomic authority they use.

I’m going to defer to others on this question.

1 Like

What “model” are you referring to, @willstewart? Because if you’re referring to our vision model, we don’t distribute that so I’m not sure how you got a hold of it. If so, I’d like to know where and how you retrieved your copy.

@kueda, what I’m referring to is right out in the open;

https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md

Including @tiwane ;

I can extract the following from the output;

  • num_detections
  • detection_classes
  • detection_boxes
  • detection_scores

by using the following;

[sess.graph.get_tensor_by_name(‘num_detections:0’),
sess.graph.get_tensor_by_name(‘detection_scores:0’),
sess.graph.get_tensor_by_name(‘detection_boxes:0’),
sess.graph.get_tensor_by_name(‘detection_classes:0’)]

When I print out the resulting 5 sets of detection_classes and scores;

350
0.9786933660507202

358
0.018166758120059967

323
0.01589692384004593

360
0.010653774254024029

348
0.003607431659474969

Yet there are no matches found (aside from a couple of birds, though this evaluated an image of a coyote) for any of the detection_classes above using the /taxa/{id} API call, which leads me to believe there is some other detection id that I have not found yet. What is the tensor output name for taxon id?

Ah, cool. That’s not our model, that’s a model the folks at tensorflow trained on a version of our dataset we published in 2017 (among other things). I have no idea what a detection_class is in the model they trained, so you’ll have to consult them about it.

If you can get a mapping to iNaturalist taxon IDs, I think the only regularly-updated archive that includes all our taxon identifiers is https://www.inaturalist.org/observations/inaturalist-dwca-with-taxa.zip. That should work, but it’s a 1.2G file.

2 Likes

@willstewart if you follow the model zoo link that you posted, you’ll see a link to the GitHub repo for the iNaturalist Species Detection Dataset. In the Readme of that GitHub repo, there are a bunch of links to download the contest dataset. Inside that dataset are json files that contain categories. Most likely, the detection classes you’re seeing are the indices of the entries in the ‘categories’ part of the json dataset.

The tensorflow team typically puts models into the model zoo to act as a helpful starting point for training up your own models on your own custom dataset.

Any further questions on the contest dataset should be posted to that GitHub.

Thanks,
alex

2 Likes

@kueda and @alex,

Thank you both, you’ve been quite helpful steering me in the right direction. Cheers!

FYI, this is for a capstone project for a Deep Learning certification, and the problem I’m trying to solve is detecting Eastern Coyotes (coywolves) on my sheep farm, and distinguishing them from my English Shepherds, who look quite similar. There is significant variation in the Eastern Coyote due to varying levels of interbreeding with wolves and dogs, and here’s an article with a picture that shows the conundrum of trying to classify it cleanly - is that a wolf or a coyote?

https://blog.nature.org/science/2015/08/03/wolf-coyote-coywolf-understanding-wolf-hybrids-just-got-a-bit-easier/