相似图片入库都正常,就是相似图搜索出现了问题
zhuyujin001 发布于2020-01 浏览:1757 回复:1
0
收藏

返回空数组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
个赞
共1条回复 最后由顾小然是我回复于2020-01
#2顾小然是我回复于2020-01

你好,可对比相似图检索示例核对请求参数https://ai.baidu.com/ai-doc/IMAGESEARCH/3k3bczqz8#%E8%BF%94%E5%9B%9E%E8%AF%B4%E6%98%8E-1

0
TOP
切换版块