无法获得Vision API v1.0 Describe Image以使用Raw图像二进制文件 [英] Unable to get Vision API v1.0 Describe Image to work with Raw image binary
问题描述
我正在尝试使用认知服务愿景1.0'描述'功能,但我不能除了传递< g class =" gr_ gr_34 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace"
data-gr-id =" 34" ID = QUOT; 34"> URL< / g取代;在邮政体内。文档说你应该能够传递'原始图像二进制文件',但是我在使用该选项时没有成功。
我已经取得了成功可以通过搜索azure认知服务找到python示例(显然我不能使用链接....)计算机视觉快速启动python-disk
我可以创建看似正确的'原始图像二进制',但我不能在这一行创建字节数组:
#将图像读入一个字节
arrayimage_data = open(image_path," rb")。read()
$
$
并使用API工具或邮递员创建相同的响应...&
$
有人能提供一个"原始图像二进制"字符串的示例,该字符串在python示例之外成功运行吗? br $>
$
这就是我要找的东西:
POST<我不能使用链接,但这是端点>
主机:<我不能使用链接,但这是主机>
内容类型:application /< g class =" gr_ gr_35 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling"数据-GR-ID =" 35 QUOT; id =" 35"> json< / g>
{" data":"< Put Raw Binary Here>"}
应该产生:
{
&NBSP; "description":{
&NBSP; &NBSP; &NBSP; "tags":[
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; "室内","
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; "table","
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; "坐着",
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; "hold","
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; "笔记本电脑",
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; "man",
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; "computer","
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; "使用","
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; "女人",
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; "living","
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; "black","
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; "white","
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; "年轻","
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; "房间",
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; "desk","
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; "play","
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; "board","
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; "people","
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; "video","
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; "remote"&b
&NBSP; &NBSP; &NBSP; ],
&NBSP; &NBSP; &NBSP; "字幕":[
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; {
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; "text":"坐在桌子上的人","
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; "置信度":0.41177881844649067
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; }¥b $ b &NBSP; &NBSP; &NBSP; ]¥b $ b &NBSP; },b $ b &NBSP; "requestId":" 45e02d4a-f983-4222-a102-57d4c6e94158",&
&NBSP; "元数据":{
&NBSP; &NBSP; &NBSP; "宽度":2400,
&NBSP; &NBSP; &NBSP; "身高":1263,
&NBSP; &NBSP; &NBSP; "格式":" Jpeg"
&NBSP; }
}
$
这是其他人试图做同样的事情,但放弃了:
https://github.com/Microsoft/BotBuilder/issues/3188#issuecomment-318970877
I'm trying to use the Cognitive Services vision 1.0 'Describe' functionality, but I'm not able to get it to work with anything except passing a <g class="gr_ gr_34 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace"
data-gr-id="34" id="34">url</g> in the post body. The documentation says you should be able to pass a 'raw image binary' but I've had zero success in using that option.
I have had success with the python example (apparently I can't use links yet....) which can be found by searching for azure cognitive-services Computer-vision quickstarts python-disk
I can create what seems to be the correct 'raw image binary', but I can't take the byte array created on this line:
# Read the image into a byte
arrayimage_data = open(image_path, "rb").read()
And use the API tool or Postman to create the same response...
Can anyone provide an example of a 'Raw image binary' string that works successfully outside of the python example?
This is kind of what I'm looking for:
POST <I can't use a link, but this is the endpoint>
Host: <I can't use a link, but this is the host>
Content-Type: application/<g class="gr_ gr_35 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling" data-gr-id="35" id="35">json</g>
{"data":"<Put Raw Binary Here>"}
Should produce:
{
"description": {
"tags": [
"indoor",
"table",
"sitting",
"holding",
"laptop",
"man",
"computer",
"using",
"woman",
"living",
"black",
"white",
"young",
"room",
"desk",
"playing",
"board",
"people",
"video",
"remote"
],
"captions": [
{
"text": "a person sitting on a table",
"confidence": 0.41177881844649067
}
]
},
"requestId": "45e02d4a-f983-4222-a102-57d4c6e94158",
"metadata": {
"width": 2400,
"height": 1263,
"format": "Jpeg"
}
}
Here is someone else trying to do the same thing, but gave up:
https://github.com/Microsoft/BotBuilder/issues/3188#issuecomment-318970877
这篇关于无法获得Vision API v1.0 Describe Image以使用Raw图像二进制文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!