时尚智能分析服务可对用户所提交图片中与时尚元素相关的内容进行分析,分析包含:
- 找出图中的服饰商品,这些商品的类型及颜色成分;
- 判断出图中的服饰、人物所包含的服装款式、图案花型等时尚元素,并以标签的形式返回。
调用说明
from productai import Client
cli = Client(ACCESS_KEY_ID, SECRET_KEY)
api = cli.get_api('dressing', '_0000111')
resp = api.query('https://yyyy')
with open("zzzz.jpg", mode='rb') as search: resp = api.query(search)
|
use ProductAI;
$product_ai = new ProductAI\API(ACCESS_KEY_ID, SECRET_KEY, 'zh-Hans');
$result = $product_ai->classifyImage('dressing', '_0000111', 'https://yyyy');
$result = $product_ai->classifyImage('dressing', '_0000111', '@zzzz.jpg');
|
import java.io.File; import cn.productai.api.core.*; import cn.productai.api.core.enums.*; import cn.productai.api.pai.entity.classify.*;
IProfile profile = new DefaultProfile(); profile.setAccessKeyId(ACCESS_KEY_ID); profile.setSecretKey(SECRET_KEY); profile.setVersion("1"); profile.setGlobalLanguage(LanguageType.Chinese); IWebClient client = new DefaultProductAIClient(profile);
ClassifyByImageUrlRequest request = new ClassifyByImageUrlRequest("dressing", "_0000111"); request.setUrl("https://yyyy");
ClassifyByImageFileRequest request = new ClassifyByImageFileRequest("dressing", "_0000111"); request.setImageFile(new File("zzzz.jpg")); request.setLanguage(LanguageType.Chinese);
ClassifyResponse response = client.getResponse(request); String json = response.getResponseJsonString();
|
using MalongTech.ProductAI.Core; using MalongTech.ProductAI.API.Entity;
IProfile profile = new DefaultProfile { Version="1", AccessKeyId=ACCESS_KEY_ID, SecretKey=SECRET_KEY, GlobalLanguage=LanguageType.Chinese }; var client = new DefaultProductAIClient(profile);
var request = new DressingClassifyByImageUrlRequest() { Url="http://yyyy", Language=LanguageType.Chinese };
var request = new DressingClassifyByImageFileRequest() { ImageFile=new System.IO.FileInfo(@".\zzzz.jpg"), Language=LanguageType.Chinese };
var response = client.GetResponse(request);
|
# 使用URL作为参数调用API curl -X POST \ -H 'x-ca-version: 1.0' \ -H 'x-ca-accesskeyid: ACCESS_KEY_ID' \ -d "url=https://yyyy" \ https://api.productai.cn/dressing/_0000111
# 或者使用本地文件作为参数调用API curl -X POST \ -H 'x-ca-version: 1.0' \ -H 'x-ca-accesskeyid: ACCESS_KEY_ID' \ -F "search=@zzzz.jpg" \ https://api.productai.cn/dressing/_0000111
|
输入参数说明
参数名称 | 类型 | 说明 | 必选 | 限制 |
---|
url | 字符串 | Query图片的链接 | 是 | 与search参数二选一 |
search | 文件 | Query图片文件内容 | 是 | 与url参数二选一 |
输出字段说明
200 HTTP状态码
服务器端成功处理,并返回结果
{ "is_err": 0, "labels": [ "都市休闲", "夏装/秋装", "橘黄", "纯色", "现代", "连体裤", "白" ], "labels-en": [ "Summer clothing/Autumn clothing", "Modern", "jumpsuit-romper", "Pure", "Orange", "White", "casual" ], "request_id": "aa28df18-e0bb-11e7-9a73-92019f9dce87", "results": [ ... ], "time": 2.163 }
|
结果字段 | 类型 | 说明 |
---|
is_err | 整数 | 1表示有错误,0表示没有错误 |
request_id | 字符串 | 本次调用的唯一ID,可以用于和ProductAI团队进行联调分析 |
results | 数组 | 图片单品时尚分析结果,详情参见Results字段内信息描述 |
labels | 数组 | 中文时尚标签 |
labels-en | 数组 | 英文时尚标签 |
Results字段内信息描述
{ "box": [ 0.30526315789473685, 0.16157894736842104, 0.4112280701754386, 0.7268421052631578 ], "colors": [ ... ], "item": "连体裤", "item-en": "jumpsuit-romper", "textures": [ "纯色" ], "textures-en": [ "Pure" ] }
|
结果字段 | 类型 | 说明 |
---|
box | 数组 | 检测出的商品在图片中的位置。格式为”x-y-w-h”。其中x,y,w,h 四个子参数的含义为:以待检测图片左上角位置为坐标(0,0),右下角位置为(1,1),x 为所框选框体左上角横坐标与图片宽度的比值,y 为所框选框体左上角纵坐标与图片高度的比值,w 为所框选框体宽与图片宽度的比值,h为所框选框体高与图片高度的比值。 |
colors | 数组 | 颜色分析结果。详情参见Colors字段内信息描述 |
item | 数组 | 中文单品类别标签 |
item-en | 数组 | 英文单品类别标签 |
textures | 数组 | 中文纹理标签 |
textures-en | 数组 | 英文纹理标签 |
Colors字段内信息描述
{ "basic-cn": "白", "basic-en": "White", "ncs": "0300-N", "percent": 0.89457, "rgb": [ 240, 240, 240 ], "w3c-cn": "幽灵白", "w3c-en": "GhostWhite" }, { "basic-cn": "橘黄", "basic-en": "Orange", "ncs": "2020-Y60R", "percent": 0.10543, "rgb": [ 205, 171, 149 ], "w3c-cn": "深鲑鱼红", "w3c-en": "DarkSalmon" }
|
结果字段 | 类型 | 说明 |
---|
basic-cn | 字符串 | 中文颜色Basic体系名称 |
basic-en | 字符串 | 英文颜色Basic体系名称 |
w3c-cn | 字符串 | 中文颜色w3c体系名称 |
w3c-en | 字符串 | 英文颜色w3c体系名称 |
ncs | 字符串 | 颜色ncs体系名称 |
percent | 浮点数 | 颜色比例 |
rgb | 数组 | RGB颜色码 |
颜色体系请参考这里
非200 HTTP状态码
服务器端遇到错误
{ "data": { "is_err": 1, "message": "Download image failed.", "request_id": "de5f84d0-e0bb-11e7-91d5-72f17f92a514", "time": 0.011 }, "status": 408 }
|
结果字段 | 类型 | 说明 |
---|
data | 字典 | 所有信息包装到data中 |
status | 整数 | HTTP状态码 |
is_err | 整数 | 1表示有错误,0表示没有错误 |
message | 字符串 | 错误信息详情 |
request_id | 字符串 | 本次调用的唯一ID,可以用于和ProductAI团队进行联调分析 |
time | 浮点数 | 服务器端计算时间 |
错误信息说明
SDK/API使用http状态码来通知客户端本次调用成功和失败
http状态码 | error_code | 说明 |
---|
200 | N/a | 数据提交成功 |
400 | N/a | 参数loc不符合规范,或Query图片为空 |
408 | N/a | Query图片下载失败,或Query图片格式解析失败,或图片颜色分析失败,或上游计算服务超时 |
标签列表
中/英文
labels字段包含的可能值列表
中文 | English | | | | | | |
---|
A字宽松裙 | A_line_loose_dress | Polo衫 | Polo_shirt | T恤衫 | Tshirt | 包臀半裙 | Slim_bottom_skirt |
保暖 | Warm | 背带裤 | Suspender pants | 背带裙 | Suspender skirt | 长袖连衣裙 | Longsleeve_dress |
衬衫 | Shirt_blouse | 衬衫裙 | Shirt_dress | 冲锋衣 | Sports_jackets | 春装/夏装 | Spring_summer_season |
搭配推荐 | Style_recommendation | 打底/吊带背心 | Tank_strap_tops | 大摆半裙 | Volumn_skirt | 大衣款 | Coat |
单肩包/手提包 | Shoulder_handbag | 冬装 | Winter_clothing | 斗篷披风 | Cape_coat | 都市休闲 | Urban_casual |
都市优雅 | Urban_elegance | 度假 | Holiday | 短裤 | Shorts | 短靴 | Booties_short_boots |
帆布鞋 | Canvas_shoes | 风衣 | Trenchcoat | 复古/民国 | Vintage/retro | 干练 | Experienced |
高跟凉鞋 | Heel_sandals | 古典 | Classical | 逛街 | Outdoor_shopping | 户外小包 | Outdoor_packet |
户外运动 | Active/athletic | 活力 | Energetic | 夹克 | Jacket | 家居 | Leisure_wear |
减龄 | Youth | 紧身裙 | Bodycon_dress | 经典百搭 | Classic_style | 居家 | Leisure_wear |
聚会 | Social_event/party | 开衫款 | Cardigans | 开学必备 | School_season | 可爱 | Cute |
阔腿裤 | Culotte_pants | 礼服和婚纱 | Formal_dress | 连体裤 | Jumpsuit_romper | 旅游 | Travel |
毛呢大衣 | Wool_coat | 棉服 | Padded_jacket | 牛仔裤 | Long_jeans | 暖冬美搭 | Warm_winter |
皮草 | Fur | 皮鞋/乐福鞋 | Leather_loafer_shoes | 皮衣 | Leather | 平底凉鞋 | Flat_sandals |
坡跟鞋/厚底鞋 | Wedge_shoes | 旗袍 | Chinese_dress | 钱包 | Wallets | 浅口高跟鞋 | Pumps |
青春 | Youth | 清纯 | Innocent | 秋冬 | Fall_winter_season | 秋装/早春 | Fall/spring_season |
实用 | Practical | 收腰连衣裙 | Waisted_dress | 手拿包 | Clutch | 淑女 | Feminine |
双肩包 | Backpacks | 随性 | Casual | 套头衫 | Pullover_tops | 通勤 | Office_lady |
拖鞋 | Slippers | 外出 | Outdoor | 外套背心 | Outerwear_vest | 卫衣 | Hoodies |
无袖衫 | Sleeveless_tops | 舞会派对 | Ball_party | 西装 | Blazers | 西装裤 | Tailored_pants |
夏装 | Summer_season | 夏装/秋装 | Summer_season | 显高 | Tall | 显气质 | Graceful |
显瘦 | Skinny | 现代 | Modern | 小脚紧身裤 | Slim_pants_leggings | 性感 | Sexy |
休假 | Vacation | 休闲裤 | Leisure_pants | 休闲裙 | Leisure_dress | 修身 | Slim_fit |
雪地靴 | Snow_boots | 雪纺衫/真丝衫 | Chiffon_tops | 羊毛衫 | Wool_sweater_tops | 泳装 | Swim_suits |
优雅 | Elegant | 优雅/淑女 | Feminine | 雨靴 | Rainboots | 羽绒服 | Down_jacket |
约会 | Dating | 运动鞋 | Sneakers | 早春/初秋 | | 早春/秋冬 |
早春/早秋 | Fall/spring_season | 早秋/冬装 | Fall_winter_season | 针织衫/镂空衫 | Knit_hollow_out_tops | 知性 | Intellectual |
知性/淑女 | Feminine | 职场商务 | Business_attire | 中长靴 | Mid_long_boots | 商务休闲 | Business_casual |
社交 | Social | 时尚平底鞋 | Flats_shoes |
item字段包含的可能值
中文 | English | | | | | | |
---|
中长靴 | Mid_long_boots | 卫衣 | Hoodies | Polo衫 | Polo_shirt | 坡跟鞋/厚底鞋 | Wedge_shoes |
连体裤 | Jumpsuit_romper | 皮鞋/乐福鞋 | Leather_loafer_shoes | 帆布鞋 | Canvas_shoes | 雨靴 | Rainboots |
风衣 | Trenchcoat | 无袖衫 | Sleeveless_tops | 衬衫裙 | Shirt_dress | 大摆半裙 | Volumn_skirt |
平底凉鞋 | Flat_sandals | 旗袍 | Chinese_dress | 双肩包 | Backpacks | 背带裤 | Suspenderpants |
单肩包/手提包 | Shoulder_handbag | 羊毛衫 | Wool_sweater_tops | 高跟凉鞋 | Heel_sandals | 牛仔裤 | Long_jeans |
背带裙 | Suspenderskirt | 羽绒服 | Down_jacket | 户外小包 | Outdoor_packet | 棉服 | Padded_jacket |
浅口高跟鞋 | Pumps | 包臀半裙 | Slim_bottom_skirt | 运动鞋 | Sneakers | 开衫款 | Cardigans |
短靴 | Booties_short_boots | 收腰连衣裙 | Waisted_dress | 外套背心 | Outerwear_vest | 短裤 | Shorts |
阔腿裤 | Culotte_pants | 泳装 | Swim_suits | 休闲裙 | Leisure_dress | 西装 | Blazers |
小脚紧身裤 | Slim_pants_leggings | A字宽松裙 | A_line_loose_dress | 斗篷披风 | Cape_coat | 针织衫/镂空衫 | Knit_hollow_out_tops |
紧身裙 | Bodycon_dress | 套头衫 | Pullover_tops | 拖鞋 | Slippers | 时尚平底鞋 | Flats_shoes |
休闲裤 | Leisure_pants | 衬衫 | Shirt_blouse | 皮草 | Fur | 皮衣 | Leather |
冲锋衣 | Sports_jackets | 雪纺衫/真丝衫 | Chiffon_tops | 西装裤 | Tailored_pants | 长袖连衣裙 | Longsleeve_dress |
夹克 | Jacket | T恤衫 | Tshirt | 手拿包 | Clutch | 毛呢大衣 | Wool_coat |
礼服和婚纱 | Formal_dress | 雪地靴 | Snow_boots | 打底/吊带背心 | Tank_strap_tops | 大衣款 | Coat |
钱包 | Wallets |
texture字段包含的可能值
中文 | English | | | | | | |
---|
条纹 | Stripe | 几何图案 | Geometric | 格子 | Plaid | 字母图案 | Letters |
动物 | Animals | 迷彩 | Camo | 人物 | Human | 花朵 | Floral |
小碎花 | Printing | 拼色 | Contrast | 卡通 | Cartoon | 波点 | Polkadots |
豹纹 | Leopard | 纯色 | Pure |