> ## Documentation Index
> Fetch the complete documentation index at: https://cloudinary.com/documentation/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Auto Tagging


[linkAssets]: dam_add_ons#google_auto_tagging

[Cloudinary](https://cloudinary.com) is a cloud-based service that provides an end-to-end asset management solution including uploads, storage, transformations, optimizations and delivery. Cloudinary offers a very rich set of image transformation and analysis capabilities and allows you to extract the semantic data from uploaded images: photo metadata (Exif & IPTC) including location and camera details, coordinates of automatically detected faces, color histogram and predominant colors. In addition, Cloudinary allows you to assign multiple tags to images for listing and managing your media assets.

[Google Cloud](https://cloud.google.com/vision/) enables developers to understand the content of an image by utilizing powerful machine learning models and quickly classify images into thousands of categories. Cloudinary provides an add-on for Google's automatic image tagging capabilities, fully integrated into Cloudinary's image management and transformation pipeline. Google analyzes image data and automatically identifies categories and suggests tags, a process that would take huge amounts of time and resources if performed manually. The analysis also improves over time as new concepts are introduced and accuracy is improved.

With the Google auto-tagging add-on, you can extend Cloudinary's powerful semantic data extraction and image tagging features. When using the Google auto-tagging add-on, your images are automatically tagged according to the categories detected in each image.
> **TIP**:
>
> :title=Tips

> * You can optionally request the category and tag results in another language or in multiple languages by registering for the [Google Translation Add-on](translation_addons) in addition to the tagging add-on. 

> * This page describes how to use the Google Auto Tagging add-on programmatically, but that you can also use the add-on for DAM use cases in Assets. For more information, see [Google Auto Tagging][linkAssets] in the Assets user guide.#### Getting started

Before you can use the Google Auto Tagging add-on:

* You must have a Cloudinary account. If you don't already have one, you can [sign up](https://cloudinary.com/users/register_free) for a free account. 

* Register for the add-on: make sure you're logged in to your account and then go to the [Add-ons](https://console.cloudinary.com/app/settings/addons) page. For more information about add-on registrations, see [Registering for add-ons](cloudinary_add_ons#registering_for_add_ons).

* Keep in mind that many of the examples on this page use our SDKs. For SDK installation and configuration details, see the relevant [SDK](cloudinary_sdks) guide.
  
* If you're new to Cloudinary, you may want to take a look at the [Developer Kickstart](dev_kickstart) for a hands-on, step-by-step introduction to a variety of features.

> **TIP**: You can also request tagging using the [Analyze API](analyze_api_guide) (Beta) which also accepts external assets to analyze.

## Image recognition and categorization

Take a look at the following photo of children ice skating:
![ice_skating.jpg](https://res.cloudinary.com/demo/image/upload/ice_skating.jpg "thumb: w_400")

```nodejs
cloudinary.image("ice_skating.jpg")
```

```react
new CloudinaryImage("ice_skating.jpg");
```

```vue
new CloudinaryImage("ice_skating.jpg");
```

```angular
new CloudinaryImage("ice_skating.jpg");
```

```js
new CloudinaryImage("ice_skating.jpg");
```

```python
CloudinaryImage("ice_skating.jpg").image()
```

```php
(new ImageTag('ice_skating.jpg'));
```

```java
cloudinary.url().transformation(new Transformation().imageTag("ice_skating.jpg");
```

```ruby
cl_image_tag("ice_skating.jpg")
```

```csharp
cloudinary.Api.UrlImgUp.BuildImageTag("ice_skating.jpg")
```

```dart
cloudinary.image('ice_skating.jpg').transformation(Transformation());
```

```swift
imageView.cldSetImage(cloudinary.createUrl().generate("ice_skating.jpg")!, cloudinary: cloudinary)
```

```android
MediaManager.get().url().transformation(new Transformation().generate("ice_skating.jpg");
```

```flutter
cloudinary.image('ice_skating.jpg').transformation(Transformation());
```

```kotlin
cloudinary.image {
	publicId("ice_skating.jpg") 
}.generate()
```

```jquery
$.cloudinary.image("ice_skating.jpg")
```

```react_native
new CloudinaryImage("ice_skating.jpg");
```

By setting the `categorization` parameter to `google_tagging` when calling Cloudinary's [upload](image_upload_api_reference#upload) or [update](admin_api#update_details_of_an_existing_resource) methods, Google is used to automatically classify the scenes of the uploaded or specified existing image. For example:

```multi
|ruby
Cloudinary::Uploader.upload("ice_skating.jpg", 
  categorization: "google_tagging")

|php_2
$cloudinary->uploadApi()->upload("ice_skating.jpg", 
  ["categorization" => "google_tagging"]);

|python
cloudinary.uploader.upload("ice_skating.jpg",
  categorization = "google_tagging")

|nodejs
cloudinary.v2.uploader
.upload("ice_skating.jpg", 
  { categorization: "google_tagging" })
.then(result=>console.log(result)); 

|java
cloudinary.uploader().upload("ice_skating.jpg", ObjectUtils.asMap(
  "categorization", "google_tagging"));

|csharp
var uploadParams = new ImageUploadParams() 
{
  File = new FileDescription(@"ice_skating.jpg"),
  Categorization = "google_tagging"
};
var uploadResult = cloudinary.Upload(uploadParams);  

|go
resp, err := cld.Upload.Upload(ctx, "ice_skating.jpg", uploader.UploadParams{
		Categorization: "google_tagging"})

|android
MediaManager.get().upload("ice_skating.jpg")
  .option("categorization", "google_tagging").dispatch();

|swift
let params = CLDUploadRequestParams().setCategorization("google_tagging")
var mySig = MyFunction(params)  // your own function that returns a signature generated on your backend
params.setSignature(CLDSignature(signature: mySig.signature, timestamp: mySig.timestamp))
let request = cloudinary.createUploader().signedUpload(
  url: "ice_skating.jpg", params: params) 

|curl
curl https://api.cloudinary.com/v1_1/demo/image/upload -X POST -F 'file=@/path/to/ice_skating.jpg' -F 'categorization=google_tagging' -F 'timestamp=173719931' -F 'api_key=436464676' -F 'signature=a781d61f86a6f818af'

|cli
cld uploader upload "ice_skating.jpg" categorization="google_tagging"
```

> **TIP**:
>
> :title=Tips

> * You can use **upload presets** to centrally define a set of upload options including add-on operations to apply, instead of specifying them in each upload call. You can define multiple upload presets, and apply different presets in different upload scenarios. You can create new upload presets in the **Upload Presets** page of the [Console Settings](https://console.cloudinary.com/app/settings/upload/presets) or using the [upload_presets](admin_api#upload_presets) Admin API method. From the **Upload** page of the Console Settings, you can also select default upload presets to use for image, video, and raw API uploads (respectively) as well as default presets for image, video, and raw uploads performed via the Media Library UI. 
> **Learn more**: [Upload presets](upload_presets)* You can run multiple categorization add-ons on the resource. The `categorization` parameter accepts a comma-separated list of all the Cloudinary categorization add-ons to run on the resource.

The upload API response includes the automatic categorization identified by the Google auto-tagging add-on. As can be seen in the response snippet below, various categories were automatically detected in the uploaded photo. The confidence score is a numerical value that represents the confidence level of the detected category, where 1.0 means 100% confidence.

```json
{
...
 "info":
  {"categorization":
    {"google_tagging":
      {"status": "complete",
       "data":
        [{"tag": "skating", "confidence": 0.9689},
         {"tag": "footwear", "confidence": 0.9587},
         {"tag": "ice skating", "confidence": 0.9513},
         {"tag": "ice rink", "confidence": 0.9469},
         {"tag": "ice skate", "confidence": 0.9271},
         {"tag": "winter", "confidence": 0.911},
         {"tag": "fun", "confidence": 0.8944},
         {"tag": "girl", "confidence": 0.8183},
         {"tag": "ice", "confidence": 0.8045},
         {"tag": "winter sport", "confidence": 0.7912},
         {"tag": "recreation", "confidence": 0.7568},
         {"tag": "child", "confidence": 0.7532},
         {"tag": "leisure", "confidence": 0.7076},
         {"tag": "play", "confidence": 0.6854},
         {"tag": "snow", "confidence": 0.6167},
         {"tag": "road", "confidence": 0.5823},
         {"tag": "sports", "confidence": 0.5223}]}}}
```

## Adding resource tags to images

Automatically categorizing your images is a useful way to organize your Cloudinary media assets, and by also providing the `auto_tagging` parameter to an `upload` or `update` call, images are automatically assigned resource tags based on the detected scene categories. The value of the `auto_tagging` parameter is the minimum confidence score of a detected category that should be automatically used as an assigned resource tag. Assigning these resource tags allows you to list and search images using Cloudinary's API and Web interface.
The following code example automatically tags an uploaded image with all detected categories that have a confidence score higher than 0.6. 

```multi
|ruby
Cloudinary::Uploader.upload("ice_skating.jpg", 
  categorization: "google_tagging", auto_tagging: 0.6)

|php_2
$cloudinary->uploadApi()->upload("ice_skating.jpg", 
  ["categorization" => "google_tagging", "auto_tagging" => 0.6]);

|python
cloudinary.uploader.upload("ice_skating.jpg",
  categorization = "google_tagging", auto_tagging = 0.6)

|nodejs
cloudinary.v2.uploader
.upload("ice_skating.jpg", 
  { categorization: "google_tagging", 
    auto_tagging: 0.6 })
.then(result=>console.log(result)); 

|java
cloudinary.uploader().upload("ice_skating.jpg", ObjectUtils.asMap(
  "categorization", "google_tagging", "auto_tagging", "0.6"));

|csharp
var uploadParams = new ImageUploadParams() 
{
  File = new FileDescription(@"ice_skating.jpg"),
  Categorization = "google_tagging",
  AutoTagging = 0.6
};
var uploadResult = cloudinary.Upload(uploadParams);  

|go
resp, err := cld.Upload.Upload(ctx, "ice_skating.jpg", uploader.UploadParams{
		Categorization: "google_tagging",
		AutoTagging:    0.6})

|android
MediaManager.get().upload("ice_skating.jpg")
  .option("categorization", "google_tagging")
  .option("auto_tagging", "0.6").dispatch();

|swift
let params = CLDUploadRequestParams()
  .setCategorization("google_tagging")
  .setAutoTagging(0.6)
var mySig = MyFunction(params)  // your own function that returns a signature generated on your backend
params.setSignature(CLDSignature(signature: mySig.signature, timestamp: mySig.timestamp))
let request = cloudinary.createUploader().signedUpload(
  url: "ice_skating.jpg", params: params) 

|curl
curl https://api.cloudinary.com/v1_1/demo/image/upload -X POST -F 'file=@/path/to/ice_skating.jpg' -F 'categorization=google_tagging' -F 'auto_tagging=0.6' -F 'timestamp=173719931' -F 'api_key=436464676' -F 'signature=a781d61f86a6f818af'

|cli
cld uploader upload "ice_skating.jpg" categorization="google_tagging" auto_tagging=0.6
```

The response of the upload API call above returns the detected categories as well as the assigned tags for categories meeting the minimum confidence score of 0.6:

```json
{ 
...    
"tags": [ "skating", "footwear", "ice skating", "ice rink", "ice skate", "winter", "fun", "girl", "ice", "winter sport", "recreation", "child", "leisure", "play", "snow" ]
...
}
```

You can also use the `update` method to apply Google auto-tagging to already uploaded images, based on their public IDs, and then automatically tag them according to the detected categories.
For example, the following image was uploaded to Cloudinary with the 'puppy' public ID.
![sample.jpg](https://res.cloudinary.com/demo/image/upload/puppy.jpg "thumb: w_400")

```nodejs
cloudinary.image("puppy.jpg")
```

```react
new CloudinaryImage("puppy.jpg");
```

```vue
new CloudinaryImage("puppy.jpg");
```

```angular
new CloudinaryImage("puppy.jpg");
```

```js
new CloudinaryImage("puppy.jpg");
```

```python
CloudinaryImage("puppy.jpg").image()
```

```php
(new ImageTag('puppy.jpg'));
```

```java
cloudinary.url().transformation(new Transformation().imageTag("puppy.jpg");
```

```ruby
cl_image_tag("puppy.jpg")
```

```csharp
cloudinary.Api.UrlImgUp.BuildImageTag("puppy.jpg")
```

```dart
cloudinary.image('puppy.jpg').transformation(Transformation());
```

```swift
imageView.cldSetImage(cloudinary.createUrl().generate("puppy.jpg")!, cloudinary: cloudinary)
```

```android
MediaManager.get().url().transformation(new Transformation().generate("puppy.jpg");
```

```flutter
cloudinary.image('puppy.jpg').transformation(Transformation());
```

```kotlin
cloudinary.image {
	publicId("puppy.jpg") 
}.generate()
```

```jquery
$.cloudinary.image("puppy.jpg")
```

```react_native
new CloudinaryImage("puppy.jpg");
```

The following code sample uses Cloudinary's `update` method to apply Google's automatic image tagging and categorization to the `puppy` uploaded image, and then automatically assign resource tags based on the categories detected with over a 90% confidence level.

```multi
|ruby
Cloudinary::Api.update("puppy", 
  categorization: "google_tagging", 
  auto_tagging: 0.9)

|php_2
$cloudinary->uploadApi()->update("puppy", [
    "categorization" => "google_tagging", 
    "auto_tagging" => 0.9]);

|python
cloudinary.api.update("puppy",
  categorization = "google_tagging", 
  auto_tagging = 0.9)

|nodejs
cloudinary.v2.api
.update("puppy", 
  { categorization: "google_tagging", 
    auto_tagging: 0.9 })
.then(result=>console.log(result));

|java
cloudinary.api().update("puppy", ObjectUtils.asMap(
  "categorization", "google_tagging", 
  "auto_tagging", 0.9));

|csharp
var updateParams = new UpdateParams("puppy") 
{
  Categorization = "google_tagging",
  AutoTagging = 0.9
};
var updateResult = cloudinary.UpdateResource(updateParams); 

|go
resp, err := cld.Admin.UpdateAsset(ctx, admin.UpdateAssetParams{
		PublicID:       "puppy",
		Categorization: "google_tagging",
		AutoTagging:    0.9})

|cli
cld admin update "puppy" categorization="google_tagging" auto_tagging=0.9
```

The response of the `update` API call includes the detected categories, and automatically assigned tags. As you can see in the response snippet below, tags were only added for the scene categories with a confidence score of over 90%.

```json
{
  ...
  "tags": [ "dog", "dog like mammal", "dog breed", "mammal" ]
  "info": {
    "categorization": {
      "google_tagging": {
        "status": "complete",
        "data": [
         {"tag": "dog", "confidence": 0.9611},
         {"tag": "dog like mammal", "confidence": 0.9508},
         {"tag": "dog breed", "confidence": 0.9396},
         {"tag": "mammal", "confidence": 0.923},
         {"tag": "dog breed group", "confidence": 0.8883},
         {"tag": "borador", "confidence": 0.8145},
         {"tag": "grass", "confidence": 0.7731},
         {"tag": "puppy", "confidence": 0.7715},
         ...
}
```

You can use the Admin API's `resource` method to return the details of a resource, including the scene categories that you already extracted using the `upload` or `update` methods.

```multi
|ruby
Cloudinary::Api.resource("puppy")

|php_2
$api->asset("puppy");

|python
cloudinary.api.resource("puppy")

|nodejs
cloudinary.v2.api
.resource("puppy")
.then(result=>console.log(result));

|java
cloudinary.api().resource("puppy", ObjectUtils.emptyMap());

|csharp
var getResourceParams = new GetResourceParams("puppy");
var getResourceResult = cloudinary.GetResource(getResourceParams);

|go
resp, err := cld.Admin.Asset(ctx, admin.AssetParams{PublicID: "puppy"})

|cli
cld admin resource "puppy"
```
