Fitur Penelusuran Produk sedang dalam mode pemeliharaan. Untuk skalabilitas yang lebih baik dan fungsi yang sama dengan Product Search, gunakan Vision Warehouse.
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Anda dapat menggunakan metode import
untuk membuat set produk dan produk dengan gambar referensi secara
bersamaan menggunakan suatu file CSV. Halaman ini menjelaskan cara memformat file CSV
Membuat gambar referensi Anda
Gambar referensi merupakan gambar yang berisi berbagai tampilan dari produk Anda. Rekomendasi
berikut berlaku:
Pastikan ukuran file tidak melebihi ukuran maksimum (20 MB).
Pertimbangkan sudut pandang yang secara logis menyoroti produk dan
berisi informasi visual yang relevan.
Buat gambar referensi yang melengkapi sudut pandang yang hilang. Misalnya,
jika Anda hanya memiliki gambar sepatu kanan dalam sepasang, berikan versi pencerminan
dari file tersebut sebagai sepatu kiri.
Upload gambar beresolusi tertinggi yang tersedia.
Tampilkan produk dengan latar belakang putih.
Konversi PNG dengan latar belakang transparan ke latar belakang solid.
Gambar harus disimpan di
bucket Cloud Storage. Jika Anda mengautentikasi panggilan pembuatan image dengan kunci API, bucket harus
bersifat publik. Jika Anda mengautentikasi dengan akun layanan, akun layanan tersebut
harus memiliki akses baca pada bucket.
Panduan pemformatan CSV
Untuk menggunakan metode import, file CSV dan gambar yang ditunjuknya
harus berada di bucket Cloud Storage. File CSV dibatasi hingga maksimum
20.000 baris; setiap baris dibatasi hingga 2.048 karakter. Untuk mengimpor
lebih banyak gambar, bagi gambar tersebut menjadi beberapa file CSV.
File CSV harus berisi satu gambar per baris dan berisi kolom berikut:
image-uri: URI Cloud Storage gambar referensi.
image-id: Opsional. Suatu nilai unik jika Anda menyediakannya. Jika tidak,
sistem akan menetapkan suatu nilai unik.
product-set-id: ID unik untuk set produk yang akan menerima
gambar yang diimpor.
product-id: ID yang ditentukan pengguna untuk produk yang diidentifikasi oleh gambar
referensi. product-id dapat dikaitkan dengan beberapa gambar referensi.
product-category: Nilai yang diizinkan adalah homegoods-v2, apparel-v2,
toys-v2, packagedgoods-v1,
dan general-v1
*;
kategori untuk produk yang diidentifikasi oleh
gambar referensi. Disimpulkan oleh sistem jika tidak ditentukan dalam permintaan
pembuatan.
Nilai yang diizinkan juga tercantum dalam
productCategory
dokumentasi referensi.
product-display-name: Opsional. Jika Anda tidak memberikan nama untuk
produk displayName
akan ditetapkan ke " ". Anda dapat memperbarui nilai ini nanti.
labels: Opsional. Suatu string (dengan tanda kutip) dari pasangan nilai
kunci yang mendeskripsikan produk dalam gambar referensi. Contoh:
"category=shoes"
"color=black,style=formal"
Vision API Product Search juga memungkinkan Anda memberikan beberapa nilai untuk
satu kunci. Contoh:
"category=shoes,category=heels"
"color=black,style=formal,style=mens"
bounding-poly: Opsional. Menentukan area minat dalam
gambar referensi. Jika kotak pembatas tidak ditentukan:
Kotak pembatas untuk gambar disimpulkan oleh Vision API; beberapa
region dalam satu gambar dapat diindeks jika beberapa produk
terdeteksi oleh API.
Baris harus diakhiri dengan koma.
Lihat contoh di bawah untuk produk tanpa poli pembatas yang ditentukan.
Jika Anda menyertakan kotak pembatas, kolom boundingPoly harus berisi
jumlah angka genap yang dipisahkan koma, dengan format
p1_x,p1_y,p2_x,p2_y,...,pn_x,pn_y. Contoh
baris terlihat seperti ini: 0.1,0.1,0.9,0.1,0.9,0.9,0.1,0.9.
Untuk menentukan kotak pembatas dengan nilai piksel yang sebenarnya dari gambar Anda, gunakan
bilangan bulat non-negatif. Dengan demikian, Anda dapat mengekspresikan kotak pembatas dalam gambar 1.000 piksel
oleh 1.000 piksel dengan cara berikut:
Vision API Product Search juga memungkinkan Anda menggunakan nilai yang dinormalkan untuk
kotak pembatas. Menentukan kotak pembatas menggunakan nilai yang dinormalisasi dengan nilai
float di [0, 1].
Dengan menggunakan nilai yang dinormalisasi, baris gambar referensi di atas juga dapat
dinyatakan sebagai:
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-02 UTC."],[],[],null,["# Formatting a bulk import CSV\n\nYou can use the [`import`](/vision/product-search/docs/reference/rest/v1/projects.locations.productSets/import)\nmethod to create a product set and products with reference images all at the\nsame time using a CSV file. This page describes how to format the CSV file.\n\nCreating your reference images\n------------------------------\n\nReference images are images containing various views of your products. The\nfollowing recommendations apply:\n\n- Make sure the size of the file doesn't exceed the maximum size (20MB).\n- Consider viewpoints that logically highlight the product and contain relevant visual information.\n- Create reference images that supplement any missing viewpoints. For example, if you only have images of the right shoe in a pair, provide mirrored versions of those files as the left shoe.\n- Upload the highest resolution image available.\n- Show the product against a white background.\n- Convert PNGs with transparent backgrounds to a solid background.\n\nImages must be stored in a [Cloud Storage](https://cloud.google.com/storage/)\nbucket. If you're authenticating your image create call with an API key, the bucket must be\npublic. If you're authenticating with a service account, that service account\nmust have read access on the bucket.\n\nCSV formatting guidelines\n-------------------------\n\nTo use the `import` method, both the CSV file *and* the images it points to\nmust be in a Cloud Storage bucket. CSV files are limited to a maximum of\n20,000 lines; each line is limited to a maximum of 2,048 characters. To import\nmore images, split them into multiple CSV files.\n\nThe CSV file must contain one image per line and contain the following columns:\n\n1. `image-uri`: The Cloud Storage URI of the reference image.\n2. `image-id`: ***Optional***. A unique value if you supply it. Otherwise, the system will assign a unique value.\n3. `product-set-id`: A unique identifier for the product set to import the images into.\n4. `product-id`: A user-defined ID for the product identified by the reference\n image. A `product-id` can be associated with multiple reference images.\n\n | **Note:** A single product may also belong to several product sets. If a `product-id` already exists on bulk import then `product-category`, `product-display`, and `labels` are ignored for that line entry.\n5. `product-category`: Allowed values are `homegoods-v2`, `apparel-v2`,\n `toys-v2`, `packagedgoods-v1`,\n and `general-v1`\n \\*;\n the category for the product identified by the\n reference image. Inferred by the system if not specified in the create\n request.\n Allowed values are also listed in the\n [`productCategory`](/vision/product-search/docs/reference/rest/v1/projects.locations.products#Product.FIELDS.product_category)\n reference documentation.\n\n \u003cbr /\u003e\n\n | **\\* Legacy `productCategory` codes:** Legacy categories (`homegoods`, `apparel`, and `toys`) are still supported, but the updated `-v2` categories should be used for new products.\n\n \u003cbr /\u003e\n\n6. `product-display-name`: ***Optional*** . If you don't provide a name for\n the product [`displayName`](/vision/product-search/docs/reference/rest/v1/projects.locations.products#Product.FIELDS.display_name)\n will be set to \" \". You can [update](/vision/product-search/docs/reference/rest/v1/projects.locations.products/patch) this value later.\n\n7. `labels`: ***Optional***. A string (with quotation marks) of key-value\n pairs that describe the products in the reference image. For example:\n\n - `\"category=shoes\"`\n - `\"color=black,style=formal\"`\n\n Vision API Product Search also allows you to provide multiple values for\n a single key. For example:\n - `\"category=shoes,category=heels\"`\n\n - `\"color=black,style=formal,style=mens\"`\n\n8. `bounding-poly`: ***Optional*** . Specifies the area of interest in the\n reference image. If a bounding box is **not** specified:\n\n 1. Bounding boxes for the image are inferred by the Vision API; multiple regions in a single image may be indexed if multiple products are detected by the API.\n 2. The line must end with a comma.\n\n See the example below for a product without a bounding poly specified.\n\n If you include a bounding box, the `boundingPoly` column should contain\n an even number of comma-separated numbers, with the format\n `p1_x,p1_y,p2_x,p2_y,...,pn_x,pn_y`. An example\n line looks like this: `0.1,0.1,0.9,0.1,0.9,0.9,0.1,0.9`.\n\n To define a bounding box with the actual pixel values of your image use\n non-negative integers. Thus, you could express bounding boxes in 1000 pixel\n by 1000 pixel images in the following way: \n\n gs://example-reference-images/10001-001/10001-001_A.jpg,img001,sample-set-summer,sample-product-123,tan summer bag,apparel-v2,\"style=womens,color=tan\",100,150,450,150,450,550,100,550\n gs://example-reference-images/10001-001/10001-001_A.jpg,img001,sample-set-summer,sample-product-456,blue summer bag,apparel-v2,\"style=womens,color=blue\",670,790,980,790,980,920,670,920\n gs://example-reference-images/10002-002/10002-002_B.jpg,img002,sample-set-summer,sample-product-123,apparel-v2,,,\n\n | **Note:** You can use Vision API's [Object Localizer](/vision/docs/detecting-objects) feature to get bounding box coordinates for generalized objects in images.\n\n Vision API Product Search also allows you to use normalized values for\n bounding boxes. Define a bounding box using normalized values with float\n values in \\[0, 1\\].\n\n Using normalized values, the above reference image rows could also be\n expressed as: \n\n gs://example-reference-images/10001-001/10001-001_A.jpg,img001,sample-set-summer,sample-product-123,tan summer bag,apparel-v2,\"style=womens,color=tan\",0.10,0.15,0.45,0.15,0.45,0.55,0.10,0.55\n gs://example-reference-images/10001-001/10001-001_A.jpg,img001,sample-set-summer,sample-product-456,blue summer bag,apparel-v2,\"style=womens,color=blue\",0.67,0.79,0.98,0.79,0.98,0.92,0.67,0.92\n gs://example-reference-images/10002-002/10002-002_B.jpg,img002,sample-set-summer,sample-product-123,apparel-v2,,,"]]