AI开放平台集成API

说明

方法说明:

1.select():选择识别的方法,参数为url的路由
2.where():过滤条件,参数为请求的参数,同官方文档一致
3.get():触发API请求,返回结果

百度

代码示例:

  1. 人脸识别(image参数无需base64):

    1
    Entry::Baidu($config)->face->select('detect')->where(['image' => file_get_contents(__DIR__ . '/file/face_detect.jpeg'), 'id_card_side' => 'front'])->get();
  2. 通用文字识别(image参数无需base64):

    1
    Entry::Baidu($this->config)->ocr->select('general_basic')->where(['url' => 'http://aip.bdstatic.com/portal/dist/1513863228374/ai_images/technology/ocr-general/general/demo-card-2.jpg'])->get();
  3. 人体关键点识别(image参数无需base64):

    1
    Entry::Baidu($config)->body->select('analysis')->where(['image' => file_get_contents(__DIR__ . '/../../file/body1.jpg')])->get();
  4. 商品检索(image参数无需base64):

    1
    Entry::Baidu($this->config)->imageSearch->select('v1/realtime_search/product/search')->where(['image' => file_get_contents(__DIR__ . '/../../file/cup.jpg')])->get();

官方文档:

百度AI开放平台

方法:

1.人脸识别(face

* detect:人脸检测
* match:人脸比对
* verify:人脸认证
* identify:人脸识别
* multi-identify:M:N 识别
* add:人脸库添加
* update:人脸库更新
* delete:人脸删除
* get:用户信息查询
* getlist:组列表查询
* getusers:组内用户列表查询
* adduser:组间复制用户
* deleteuser:组内删除用户

2.文字识别(ocr)

* idcard:身份证
* bankcard:银行卡
* general:通用文字识别(含位置信息版)
* general_basic:通用文字识别
* webimage:网络图片文字识别
* general_enhanced:通用文字识别
* driving_license:驾驶证识别
* vehicle_license:行驶证识别
* license_plate:车牌识别
* accurate:通用文字识别(含位置高精度版)
* accurate_basic:通用文字识别(高精度版)
* receipt:通用票据识别
* business_license:营业执照识别

3.人体识别(body)

* analysis:人体关键点识别
* attr:人体属性识别
* num:人流量统计

4.图片搜索(imageSearch)

* realtime_search/same_hq/add:相同图检索—入库
* realtime_search/same_hq/search:相同图检索—检索
* realtime_search/same_hq/delete:相同图检索—删除
* realtime_search/same_hq/update:相同图检索—更新
* v1/realtime_search/similar/add:相似图检索—入库
* v1/realtime_search/similar/search:相似图检索—检索
* v1/realtime_search/similar/delete:相似图检索—删除
* v1/realtime_search/similar/update:相似图检索—更新
* v1/realtime_search/product/add:商品—入库
* v1/realtime_search/product/search:商品—检索
* v1/realtime_search/product/delete:商品—删除
* v1/realtime_search/product/update:商品—更新

腾讯优图

代码示例:

  1. 人脸检测(where()方法可以传入url或者image)

    1
    Entry::Youtu($config)->face->select('detectface')->where(['image' => __DIR__ . '/../../file/face_01.jpg', 'mode' => 1])->get();
  2. 通用文字检测(where()方法可以传入url或者image)

    1
    Entry::Youtu($this->config)->ocr->select('generalocr')->where(['url' => 'http://open.youtu.qq.com/app/img/experience/char_general/ocr_common07.jpg'])->get();
  3. 图像处理(默认调用人脸融合API)

    1
    2
    3
    4
    $opData = [['cmd' => 'doFaceMerge', 'params' => ['model_id' => 'cf_wzry_zhugeImage']]];
    //$request = ['img_data' => __DIR__ . '/../../file/face_01.jpg', 'rsp_img_type' => "url", 'opdata' => $opdata];
    $params = ['img_data' => 'http://open.youtu.qq.com/app/img/experience/face_img/face_04.jpg', 'rsp_img_type' => "url", 'opdata' => $opData];
    $result = Entry::Youtu($config)->imageProcess->select()->where($params)->get();//人脸融合

官方文档:

腾讯AI开放平台

方法:

1.人脸识别(face

* detectface:人脸检测
* faceshape:五官定位
* identify:人脸识别

2.文字识别(ocr)

* generalocr:通用
* idcardocr:身份证
* bcocr:名片
* bizlicenseocr:营业执照
* creditcardocr:银行卡
* plateocr:车牌识别
* driverlicenseocr:驾驶证(1)行驶证(0)识别

3.图像处理(imageProcess)

* pitu_open_access_for_youtu.fcg:人脸融合,默认参数,可以不填

FACE++

代码示例:

  1. 人脸识别(where()方法可以传入image_url,image_file,image_base64):

    1
    Entry::FacePlus($this->config)->face->select('detect')->where(['image_file' => __DIR__ . '/../../file/face_01.jpg', 'return_attributes' => 'skinstatus'])->get();
  2. 手势识别(where()方法可以传入image_url,image_file,image_base64):

    1
    Entry::FacePlus($config)->body->select('gesture')->where(['image_url' => 'http://open.youtu.qq.com/app/img/experience/face_img/face_06.jpg', 'return_attributes' => 'skinstatus'])->get();
  3. 驾驶证识别(where()方法可以传入image_url,image_file,image_base64):

    1
    Entry::FacePlus($this->config)->ocr->select('ocrdriverlicense')->where(['image_url' => 'http://open.youtu.qq.com/app/img/experience/char_general/ocr_jsz_01.jpg'])->get();
  4. 识别图片场景和图片主体(where()方法可以传入image_url,image_file,image_base64):

    1
    Entry::FacePlus($this->config)->image->select('detectsceneandobject')->where(['image_base64' => base64_encode(file_get_contents(__DIR__ . '/../../file/cup.jpg'))])->get();

官方文档:

FACE++AI开放平台

方法:

1.人脸识别(face

* detect:人脸检测和人脸分析
* compare:两个人脸进行比对
* search:在一个已有的 FaceSet 中找出与目标人脸最相似的一张或多张人脸
* create:创建一个人脸的集合 FaceSet
* addface:为一个已经创建的 FaceSet 添加人脸标识 face_token
* removeface:移除一个FaceSet中的某些或者全部face_token
* update:更新一个人脸集合的属性
* getdetail:获取一个 FaceSet 的所有信息
* delete:删除一个人脸集合
* getfacesets:获取某一 API Key 下的 FaceSet 列表及其 faceset_token、outer_id、display_name 和 tags 等信息

2.人体识别(body

* detect:人体检测和人体属性分析
* segment:识别传入图片中人体的完整轮廓,进行人形抠像
* gesture:手势识别

3.证件识别(ocr)

* ocridcard:身份证
* ocrdriverlicense:驾驶证
* ocrvehiclelicense:行驶证
* ocrbankcard:银行卡

4.图像识别(image)

* detectsceneandobject:图片分析,识别图片场景和图片主体
* recognizetext:图片分析,找出图片中出现的文字信息
* general:通用文字识别(含位置信息版)
* mergeface:人脸融合