返回空数组Array ( [has_more] => [log_id] => 1529100770204516144 [result_num] => 0 [result] => Array ( ) )
我还专门去百度图片那个网站找了很多相似的图片入库再搜索还是空数组 ,请问是我哪里没弄对吗?
//相似图片--入库
public function imgSimilarBase($imgPath){
$imageData=file_get_contents($imgPath);
$options = array();
$options["brief"] ='{"imgurl":"hahahaohaohao", "postid":"123"}';
$options["tags"] = "103,12";
$res=$this->client->similarAdd($imageData, $options);
if(isset($res['error_code'])){
return false;
}else{
return $res;
}
}
print_r($img->imgSimilarsou(ROOTPATH.'uploads/2020/search/999.png'));
//相似图片--搜索
public function imgSimilarsou($imgPath){
$imageData=file_get_contents($imgPath);
$options = array();
$options["tags"] = "103,12";
$options["tag_logic"] = "1";
$options["pn"] = "100";
$options["rn"] = "250";
$res=$this->client->similarSearch($imageData, $options);
if(isset($res['error_code'])){
return false;
}else{
return $res;
}
}
收藏
点赞
0
个赞
请登录后评论
TOP
切换版块
你好,可对比相似图检索示例核对请求参数https://ai.baidu.com/ai-doc/IMAGESEARCH/3k3bczqz8#%E8%BF%94%E5%9B%9E%E8%AF%B4%E6%98%8E-1