Getting Started with the Roboflow Inference API
Key Takeaways
The Roboflow Inference API is used for making inferences on test images, specifically object detection endpoints, and can be implemented in various programming languages such as Python, JavaScript, and Bash with curl.
Full Transcript
[Music] [Music] oh hey there i'm just using the roboflow inference api to make inferences on my test images this youtube is designed to kind of take apart the roboflow imprints api so you can use it to implement computer vision specifically object detection endpoints into your own application so today we're going to walk through the nuances of the roboflow infrareds api that is all the request parameters and how you can use the rover inference api in your own application so today we're going to be walking through a tutorial in python here but we're also going to talk about using the inference api through bash command with curl and we're also going to talk about using it in a javascript app and the good thing is that all the parameters that go into the api are all universal across these languages so no matter which language you're going to be using the inference api in this tutorial should be relevant to you so kind of diving in what exactly are we trying to do with difference api so when you train a computer vision model you get a model that can then make inference but this model can sometimes be heavy it can be difficult to port into the destinations you want to so you might just want to have it hosted on a cloud instance and be able to post your image up to a cloud instance receive the inferences back and then go do what you want with them in your application which app without having to build all kinds of uh heavy dependencies around your models in the application that you're developing so the rover inference api was built with this uh with this mission in mind so today i have a model that's been trained in a mushroom data set so here you can see this is a data set of mushrooms we have various mushrooms tagged here so we have chicken of the woods and we have chanterelles and these have all been labeled and then trained and this is how you train uh custom models is just by feeding custom data in and then printing a model based on the data that you fed it um so this is a mushroom's endpoint that we have here but this could be any use case that you want and perhaps by the time you've gotten to this video you've already trained a few models and you already have them ready for use so um let's kind of dive into the inference api documentation so this is that docsetrofl.com backslash inference and here you can see the different things you can do with the inference api so you can use a curl command or you can use these examples that we have here at the bottom for python javascript perl and then we also have other languages available at request so basically the api has a few parameters so it has the image which is obviously a key thing to be setting up and that's going to be a base64 encoded string and then we have the name the endpoint we have your um access token um which is the token that is going to go in um and will be um basically authenticated um to know that you have rights to access the api and then we have a few other parameters that we'll explore in the um use case here that are also things that you can do to affect the way the boxes are coming back and the way they look and and uh things like that so let's go and dive into our example here so this mushrooms data set i've ported it into our notebook here with a query string so these are just um these are just example images that we're going to be able to pass into the inference api so you put your token in here if you're using this example and then this is just python code to define the url that we're going to be passing to so uh you put the url where the um the inferred.roboflow.com is and then you put your endpoint and then you put an access token so the access token authenticates to the endpoint and then you can choose these parameters that i've defined here so format is either you can get an image back with a box drawn on it this is useful just for testing out uh the inference api but you can also put in a json so when you build into an application you're probably going to be put in format equals json and then you can also define confidence here so confidence is uh basically like lower confidence the more boxes you're going to get back and the higher the confidence the more of a threshold you're going to be putting on your model to basically be requiring it to have higher confidence in order to make predictions and then stroke is just the stroke side so if you put a higher stroke size the high the more width is going to be drawn around the box and then all those parameters are combined into a query string which is going to be the url that we're going to be posting to so let's take an example image here that we might want to use so this is a picture of a chanterelle and we're going to see if the model is able to identify chanterelle or if it's going to be able to tell where the chanterelle is in the image uh so in order to do so we can take that image here then we open it with pill and then we convert it into a base64 encoded string and we put that base64 encoded string up to a post request to the url that we've defined and then we'll get some content back and then in order to view it since we specified image up above we're going to get a base64 encoded string back so we're going to decode that and then we'll see the output here so at the beginning of the video you kind of saw me make this inference already so it's no surprise that it's going to work but you can see here that the inference api has correctly identified the mushroom so the other thing i want to show you guys here is what it looks like if you specify json here and we can go ahead and make the inference again except this time we're going to be rather than getting a basic sort encoded string back we're going to be getting um a json back so rather than doing r.content for response that content we're going to do response.json and we won't need this stuff since we won't be printing out the string anymore okay so there we go we have the json method but we actually need to call it as a method um so here you can see what happens when you get the json back is you'll rather you'll just get definitions of the coordinates so this is the x y and width height so the x y is the middle of the image and then you'll get the width and height of the image there and you'll get the class back so it correctly identified this image as chanterelle and then you also get a confidence value back here so that confidence is 0.6 so if we had specifies a confidence parameter that was higher than 0.6 we wouldn't have gotten anything back here for predictions but that's basically the ins and outs of the rebelflow inference api again here this is a python example but all the parameters are the same if you want to do a curl command here you can use this base64 encode your image and then just type that into the curl command to post the url and then javascript is going to look very similar and again all of those details are on the docs for on the docs.roboflow.com backslash inference if you're excited about using the inference api please let us know and thanks again for watching this video and we'll see you in the next video thanks
Original Description
An example of leveraging cloud inference to host your object detection models.
Docs:
https://docs.roboflow.com/inference
Notebook:
https://colab.research.google.com/drive/1C81qr1ejBRIG6lVKOg9z6EXJ_lkjyIxJ
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Roboflow · Roboflow · 59 of 60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
▶
60
YOLOv3 PyTorch Notebook Tutorial
Roboflow
How to Train YOLOv4 on a Custom Dataset (PyTorch)
Roboflow
How to Train YOLOv5 on a Custom Dataset
Roboflow
How to Use the Roboflow Dataset Health Check
Roboflow
What is Mean Average Precision (mAP)?
Roboflow
How to Use the Roboflow Model Library
Roboflow
How to Train EfficientDet in TensorFlow 2 Object Detection
Roboflow
How to Train YOLO v4 Tiny (Darknet) on a Custom Dataset
Roboflow
Ask the Roboflow Team Anything - Episode 1
Roboflow
Exploring The COCO Dataset
Roboflow
Community Spotlight: Improving Uno with Computer Vision
Roboflow
Mosaic Data Augmentation - Deep Dive
Roboflow
Hands on with the OAK-1
Roboflow
Glenn Jocher: What is New in YOLO v5?
Roboflow
How to Use Amazon Rekognition Custom Labels and Roboflow to Build an Object Detection Model
Roboflow
An Interview with Brandon Gilles, Luxonis Founder and OAK Chief Architect
Roboflow
How to Train a Custom Mobile Object Detection Model (with YOLOv4 Tiny and TensorFlow Lite)
Roboflow
Tackling the Small Object Problem in Object Detection
Roboflow
Fast.ai v2 Released - What's New?
Roboflow
Teaser: Roboflow Train (1-Click Computer Vision AutoML)
Roboflow
How to Train a Custom Resnet34 Image Classification Model
Roboflow
How to Label Images for Object Detection with CVAT
Roboflow
Deploy YOLOv5 to Jetson Xavier NX at 30 FPS
Roboflow
Elisha Odemakinde Hosts Roboflow ML Engineer, Jacob Solawetz
Roboflow
Getting Started with VoTT - Computer Vision Annotation
Roboflow
How to Manage Classes in Object Detection (Rename, Combine, Balance)
Roboflow
How to Train YOLOv4 on a Custom Dataset in Darknet
Roboflow
Is Grayscale a Preprocessing or Augmentation Step in Computer Vision?
Roboflow
Getting Started with Image Data Augmentation
Roboflow
Glenn Jocher: Image Augmentation in YOLO v5 and Beyond
Roboflow
GA Hosts Roboflow - Healthcare and AI
Roboflow
How do self driving cars know when to stop?
Roboflow
What is PASCAL VOC XML?
Roboflow
AutoML Showdown: Google vs Amazon vs Microsoft
Roboflow
How is computer vision changing manufacturing?
Roboflow
The Alphabet in American Sign Language
Roboflow
Luxonis OAK-D: Computer Vision on Device
Roboflow
How to Train a Custom Faster R-CNN Model with Facebook AI's Detectron2 | Use Your Own Dataset
Roboflow
TensorFlow vs PyTorch: Fireside
Roboflow
Occlusion Techniques in Computer Vision
Roboflow
A Customizable Web Application for Your Computer Vision Model
Roboflow
Model Tradeoffs and the Future of Computer Vision
Roboflow
Designing an Augmented Reality Board Game App
Roboflow
YOLOv4 - Advanced Tactics
Roboflow
How to Use CreateML and Build a Computer Vision iPhone App | AR Object Detection
Roboflow
Fireside Chat: Computer Vision in Agriculture
Roboflow
Scaled-YOLOv4 Tops EfficientDet: Research Rundown
Roboflow
What is Image Preprocessing?
Roboflow
Building a Community of Creators with BlkArthouse and Von Deon
Roboflow
How to Train Scaled-YOLOv4 to Detect Custom Objects
Roboflow
Intro to Computer Vision: Fireside
Roboflow
The Best Way to Annotate Images for Object Detection
Roboflow
The Computer Vision Process: Fireside
Roboflow
How to Annotate Images with Your Team Using Roboflow
Roboflow
Introducing the Roboflow Object Count Histogram
Roboflow
How Fast is the M1 at Machine Learning? Benchmarking Apple's M1 and Intel's Chips
Roboflow
CLIP: OpenAI's amazing new zero-shot image classifier
Roboflow
How I hacked my Nest camera to run custom models
Roboflow
Getting Started with the Roboflow Inference API
Roboflow
Transfer Learning in Computer Vision | What, How, Why
Roboflow
More on: CV Basics
View skill →Related AI Lessons
⚡
⚡
⚡
⚡
Cloud-Optimized OpenCV + A Special Surprise Announcement on OpenCV Live
OpenCV Blog
When the Camera Becomes an Exam Proctor: Building an AI-Powered Exam Monitoring System with…
Medium · Python
When the Camera Becomes an Exam Proctor: Building an AI-Powered Exam Monitoring System with…
Medium · Deep Learning
When the Camera Becomes an Exam Proctor: Building an AI-Powered Exam Monitoring System with…
Medium · Cybersecurity
🎓
Tutor Explanation
DeepCamp AI