Getting Tulip + Matroid to detect Cats
I want to see how fast I can go from zero to detecting Cats using Matroid. Here we go.
Search up a built in detector.
Test the detector, yup that’s a cat alright.
I’m going to attempt to create a stream.
It looks like I can use the detector with my Cat test
Ok, fair enough. Now how do I send an image to a stream.
I’m guessing I use these IDs
Ok, lets read some API documentation.
Authentication
In order to use the API, you will need to register an account at matroid.com and find your Access Token. Once registered, you can find the token in your Account Settings page. When making RESTful API calls, make sure to supply the authentication token. For example:
curl “https://app.matroid.com/api/v1/detectors” \
-H Authorization:”Bearer your-token-here”
Ok, I was able to find my token, let’s test a thing with postman
Ok, I got some info out of it!
Ok, now to try with a stream
Ok, again using postman
Ok, on the Matroid site I can see the detection.
Ok, how do I get the info back out of Matroid
Looks like I use the
Streams – Get monitoring result
Retrieves results for a monitoring.
get
/api/v1/monitorings/:monitoringId(?query)
curl -X GET -G “https://app.matroid.com/api/v1/monitorings/your-monitoring-id” \
-H Authorization:”Bearer your-token-here”
-d “format=csv”
–data-urlencode “startTime=2022-05-01 00:00:00”
–data-urlencode “endTime=2022-06-01 00:00:00”
Seems passing the timestamp would help with retrieval so I will do that when I make the tulip app.
Ok, lets make our connector.
And then our function
I learned a couple of things, you can change the image input type to ‘File’ and then to make it work for Matroid you have to name it file.
Then you add it as a ‘File’
For getting the outputs you just have to success to have it extract the value for success from the JSON. (Or you can just click in the body!)
I didn’t get the timestamp to work, probably needs reformatting.
Now to use it in our app
Add a button and some logic to call the function.
Test
Shows up on Matroid
It’s 98% cat, 2% demon
Ok, now lets get the detections out of it.
Back to the function factory.
Change it to a get,
Add start and end times as parameters
I’m still figuring out the start time syntax, seems it needs the time zone information.
I spent more time than I wanted getting the timestamp formatted correctly. I also subtract a minute and add a minute to make a window for the detection. I can probably use the formatting logic to send my defined timestamp which would help. This is what it looks like
And then it looks like this