Background Removal Tool
Accurately remove the background from images using the SentiSight.ai Pre-Trained Model
The SentiSight.ai platform is the place for a background removal AI, with a degree of accuracy.
Background removal tools extract the main subject of the image, and subsequently eliminate the unwanted background elements of the image.
There are many use cases for background removal (link to blog), across sectors including:
- Retail
- Web Design
- Medical Imaging
- Data Annotation
- Agriculture
Improved accuracy and speed with background removal AI
Our pre-trained model speeds up the process of removing the background from a large volume of images. The advanced Image Recognition used for the tool ensures the results are accurate and precise.
SentiSight.ai’s intuitive and easy-to-use interface allows everyone, regardless of technical expertise, to use our powerful background removal pre-trained model.
Using the AI Background Remover Tool in Three Easy Steps
Using the SentiSight.ai web interface is the quickest way to use the background removal tool. Once you have logged in to your SentiSight.ai account, simply:
Select Pre-Trained Models > Background Removal
Three different ways to use the Background Removal Pre Trained Model
You can use the background removal pre-trained model in a number of ways, depending on your requirements and set-up.
Using the Background Removal Pre-Trained Model via REST API
SentiSight.ai currently offers eight pre-trained models, including the Background Removal tool. To use one of these models via REST API, you will need the following details:
- API token
This is available under the ‘Wallet information’ tab of the online dashboard
Use this endpoint for predictions: https://platform.sentisight.ai/api/pm-predict/Background-removal/
The REST API query will return a JSON response containing base64 encoded PNG image data that can be converted into PNG image files with a variety of apps and online services.
If you want to trim the empty space from the image after removing the background, you can add the “?crop=true” parameter to the request URL.
Below you will find image upload samples for background removal. You can adapt other pre-trained models' samples using URL or Base64 image to use with background removal.
TOKEN="your_token"
MODEL="your_model_name" # "General-classification", "Places-classification", "NSFW-classification" or "Object-detection"
IMAGE_FILENAME="your_image_path"
curl -H "X-Auth-token: $TOKEN" --data-binary @"$IMAGE_FILENAME" \
-H "Content-Type: application/octet-stream" \
-X POST "https://platform.sentisight.ai/api/pm-predict/$MODEL"
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.file.Files;
public class App
{
public static void main( String[] args ) throws IOException
{
if (args.length < 4) {
System.out.println("Usage: java -jar sample.jar api_token file");
}
String token = args[0];
String imageFilename = args[1];
String modelName = "General-classification"; // Change to "General-classification", "Places-classification", "NSFW-classification", "Object-detection" or "Instance-segmentation"
byte[] bytes = Files.readAllBytes(new File(imageFilename).toPath());
URL url = new URL("https://platform.sentisight.ai/api/pm-predict/" + modelName);
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setRequestProperty("Content-Type", "application/octet-stream");
connection.setRequestProperty("X-Auth-token", token);
connection.setRequestMethod("POST");
connection.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
wr.write(bytes);
wr.flush();
wr.close();
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String output;
StringBuffer response = new StringBuffer();
while ((output = in.readLine()) != null) {
System.out.println(output);
response.append(output);
}
in.close();
}
}
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Sample</title>
<script type="text/javascript">
const baseApiURL = 'https://platform.sentisight.ai/api/';
let token = '';
let predictionId;
let results;
let resultOutput;
function predict() {
token = document.getElementById('tokenfield').value;
const modelName = "General-classification"; // Change to "General-classification", "Places-classification", "NSFW-classification" or "Object-detection"
const input = document.getElementById('upload');
resultOutput = document.getElementById('output');
const file = input.files[0];
const fr = new FileReader();
fr.onload = function() {
results = apiPostRequest('pm-predict/' + modelName, fr.result);
let parsedResults = JSON.parse(results);
resultOutput.innerText = results;
console.log(parsedResults);
}
fr.readAsArrayBuffer(file);
}
function apiPostRequest(request, body) {
const xmlHttp = new XMLHttpRequest();
xmlHttp.open("POST", baseApiURL + request, false);
xmlHttp.setRequestHeader('Content-Type', 'application/octet-stream');
xmlHttp.setRequestHeader('X-Auth-token', token);
xmlHttp.send(body);
console.log(xmlHttp.responseText);
return xmlHttp.responseText;
}
</script>
</head>
<body>
Token: <input id="tokenfield" type="text" name="" value="">
<br>
Upload image: <input id="upload" type="file" name="" value="">
<br>
<button type="button" onclick="predict()">Predict</button>
<br><br><br>
<p id="output">Your results will go here!</p>
</body>
</html>
import requests
token = "your_token"
model = "your_model_name" # "General-classification", "Places-classification", "NSFW-classification" or "Object-detection"
image_filename = "your_image_path"
headers = {"X-Auth-token": token, "Content-Type": "application/octet-stream"}
with open(image_filename, 'rb') as handle:
r = requests.post('https://platform.sentisight.ai/api/pm-predict/{}/'.format(model), headers=headers, data=handle)
if r.status_code == 200:
print(r.text)
else:
print('Error occured with REST API.')
print('Status code: {}'.format(r.status_code))
print('Error message: ' + r.text)
using System;
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
namespace Sample
{
class Program
{
static void Main(string[] args)
{
if (args.Length < 3)
{
Console.WriteLine("Expected arguments: api_token model_name file");
return;
}
var token = args[0];
var modelName = args[1];
var imageFilename = args[2];
var bytes = File.ReadAllBytes(imageFilename);
var data = new ByteArrayContent(bytes);
data.Headers.ContentType = MediaTypeHeaderValue.Parse("application/octet-stream");
var uri = new Uri($"https://platform.sentisight.ai/api/pm-predict/{modelName}");
var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-Auth-token", token);
var response = client.PostAsync(uri, data);
var result = response.Result.Content.ReadAsStringAsync().Result;
Console.WriteLine(result);
}
}
}
Pricing
SentiSight.ai is supported by a pay-as-you-go wallet based system that allows users to pay for only what they use, maximizing flexibility and value for money.
New users get €20 of free credits when you sign up for a SentiSight.ai account.
Every user receives €5 a month of free credits for use on the platform.
There is no need to enter your billing information to receive these free credits. Therefore, the SentiSight.ai platform can be completely free to use if you do exceed the €5 monthly free credit buffer.
The cost to train and use the Pre-trained models are as follows;
Pricing Range | 1-10,000 Predictions | 10,001-100,000 predictions | 100,000+ predictions | |
---|---|---|---|---|
Prediction | 0.0008-0.001 EUR | 0.001 eur/prediction | 0.0009 eur/prediction | 0.0008 eur/prediction |
For full details of SentiSight.ai’s pricing model, including project management features and extra disk space, please visit the Pricing Page.
Contents
- Accurately remove the background from images using the SentiSight.ai Pre-Trained Model
- Improved accuracy and speed with background removal AI
- Using the AI Background Remover Tool in Three Easy Steps
- Three different ways to use the Background Removal Pre Trained Model
- Using the Background Removal Pre-Trained Model via REST API
- Pricing