Products

SIGN UPLOG IN
Nudity Detection

Models / Drug Detection

Recreational Drug and Medical Drug Detection

Description of concepts

The API returns confidence scores for the following concepts:

ConceptDescription

Recreational drugs

recreational_drug.prob

Photos and illustrations containing recreational drugs. This includes:

  • Powder-like drugs such as cocaine, ketamine, where indicated by context (in line, in pouch) or by usage (snorting)
  • Self-administration through syringes of drugs such as heroin
  • Cannabis buds, joints and related products
  • Cannabis leaf or plant
  • Bongs, pipes, or other paraphernalia related to marijuana consumption
  • Pills and pill bottles in a recreational context (i.e. unlikely to be for medical use, based on quantity, color/shape or context)

Cannabis

cannabis

Any reference to cannabis/marijuana. This includes:

  • Cannabis logo (cannabis leaf)
  • Cannabis plant
  • Cannabis drug (joints, haschich)

Cannabis logo (only)

cannabis_logo_only

Image where the only reference to cannabis is through a symbol designed to represent marijuana (think of the cannabis leaf outline). This typically appears on objects, apparels or as logos super-imposed on the image. If other references to marijuana are present, then this class will not trigger.

Cannabis plant

cannabis_plant

Marijuana plants.

Cannabis drug

cannabis_drug

Displays of weed, marijuana buds, joints, blunts. This also includes marijuana-related paraphernalia such as pipes, bongs.

Recreational drug excluding cannabis

recreational_drug_not_cannabis

Photos and illustrations:

  • Snorting of drugs such as cocaine, ketamine
  • Self-administration through syringes of drugs such as heroin

Medical pills

pills

Pills and pill bottles in a medical context.

Medical paraphernalia

paraphernalia

Medical syringes or medical equipment. This does not include syringes in the context of recreational drugs such as self-administration.

Excluded concepts

The API will ignore situations where regular tobacco is smoked. This means that the following concepts would not be flagged as drug:

  • Regular Tobacco
  • Industrial cigarettes, cigarette packs
  • People smoking or puffing, unless there are references to recreational drugs
  • Smoking pipes used with regular tobacco
  • Hookahs, shishas

To detect tobacco smoking and tobacco products, please refer to the Smoking & Tobacco detection model.

Use the model

If you haven't already, create an account to get your own API keys.

Detect drugs

Let's say you want to moderate an image containing marijuana:

You can either upload a public URL to the image, or upload the raw binary image. Here's how to proceed if you choose to share the image's public URL:


curl -X GET -G 'https://api.sightengine.com/1.0/check.json' \
    -d 'models=recreational_drug,medical' \
    -d 'api_user={api_user}&api_secret={api_secret}' \
    --data-urlencode 'url=https://sightengine.com/assets/img/examples/cann.jpg'


# this example uses requests
import requests
import json

params = {
  'url': 'https://sightengine.com/assets/img/examples/cann.jpg',
  'models': 'recreational_drug,medical',
  'api_user': '{api_user}',
  'api_secret': '{api_secret}'
}
r = requests.get('https://api.sightengine.com/1.0/check.json', params=params)

output = json.loads(r.text)


$params = array(
  'url' =>  'https://sightengine.com/assets/img/examples/cann.jpg',
  'models' => 'recreational_drug,medical',
  'api_user' => '{api_user}',
  'api_secret' => '{api_secret}',
);

// this example uses cURL
$ch = curl_init('https://api.sightengine.com/1.0/check.json?'.http_build_query($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$output = json_decode($response, true);


// this example uses axios
const axios = require('axios');

axios.get('https://api.sightengine.com/1.0/check.json', {
  params: {
    'url': 'https://sightengine.com/assets/img/examples/cann.jpg',
    'models': 'recreational_drug,medical',
    'api_user': '{api_user}',
    'api_secret': '{api_secret}',
  }
})
.then(function (response) {
  // on success: handle response
  console.log(response.data);
})
.catch(function (error) {
  // handle error
  if (error.response) console.log(error.response.data);
  else console.log(error.message);
});

The API will then return a JSON response:

                    
                    
{
    "status": "success",
    "request": {
        "id": "req_gcTp4s63IAAni0lFOT7KK",
        "timestamp": 1714997478.552115,
        "operations": 1
    },
    "recreational_drug": {
        "prob": 0.99,
        "classes": {
            "cannabis": 0.99,
            "cannabis_logo_only": 0.01,
            "cannabis_plant": 0.01,
            "cannabis_drug": 0.99,
            "recreational_drugs_not_cannabis": 0.01
        }
    },
    "medical": {
        "prob": 0.01,
        "classes": {
            "pills": 0.01,
            "paraphernalia": 0.01
        }
    },
    "media": {
        "id": "med_gcTpqyOZ18IMsiMe4Ar28",
        "uri": "https://sightengine.com/img/assets/examples/cann.jpg"
    }
}
                    
                

Any other needs?

See our full list of Image/Video models for details on other filters and checks you can run on your images and videos. You might also want to check our Text models to moderate text-based content: messages, reviews, comments, usernames...

Was this page helpful?