Skip to content

Commit 659e1fa

Browse files
author
ruanshimin
committed
新增nlp 地址识别,图像识别车辆车辆检测,车辆外观损伤识别,人体识别的手部关键点识别 => 2.4.5
1 parent 75a2afa commit 659e1fa

File tree

5 files changed

+72
-46
lines changed

5 files changed

+72
-46
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "baidu-aip-sdk",
3-
"version": "2.4.4",
3+
"version": "2.4.5",
44
"description": "百度AI开放平台Nodejs SDK, 文档以及详情请访问官网: https://ai.baidu.com",
55
"main": "src/index.js",
66
"scripts": {
@@ -15,6 +15,7 @@
1515
"dependencies": {
1616
"debug": "^2.6.0",
1717
"iconv-lite": "^0.4.15",
18+
"keep-alive-agent": "0.0.1",
1819
"request": "^2.79.0",
1920
"underscore": "^1.8.3"
2021
},

src/AipBodyAnalysis.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const GESTURE_PATH = '/rest/2.0/image-classify/v1/gesture';
3232
const BODY_SEG_PATH = '/rest/2.0/image-classify/v1/body_seg';
3333
const DRIVER_BEHAVIOR_PATH = '/rest/2.0/image-classify/v1/driver_behavior';
3434
const BODY_TRACKING_PATH = '/rest/2.0/image-classify/v1/body_tracking';
35+
const HAND_ANALYSIS_PATH = '/rest/2.0/image-classify/v1/driver_behavior';
3536

3637

3738
/**
@@ -179,6 +180,22 @@ class AipBodyAnalysis extends BaseClient {
179180
};
180181
return this.commonImpl(objectTools.merge(param, options));
181182
}
183+
184+
/**
185+
* 手部关键点识别接口
186+
*
187+
* @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
188+
* @param {Object} options - 可选参数对象,key: value都为string类型
189+
* @description options - options列表:
190+
* @return {Promise} - 标准Promise对象
191+
*/
192+
handAnalysis(image, options) {
193+
let param = {
194+
image: image,
195+
targetPath: HAND_ANALYSIS_PATH
196+
};
197+
return this.commonImpl(objectTools.merge(param, options));
198+
}
182199
}
183200

184201
module.exports = AipBodyAnalysis;

src/AipImageClassify.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ const METHOD_POST = 'POST';
2828
const ADVANCED_GENERAL_PATH = '/rest/2.0/image-classify/v2/advanced_general';
2929
const DISH_DETECT_PATH = '/rest/2.0/image-classify/v2/dish';
3030
const CAR_DETECT_PATH = '/rest/2.0/image-classify/v1/car';
31+
const VEHICLE_DETECT_PATH = '/rest/2.0/image-classify/v1/vehicle_detect';
32+
const VEHICLE_DAMAGE_PATH = '/rest/2.0/image-classify/v1/vehicle_damage';
3133
const LOGO_SEARCH_PATH = '/rest/2.0/image-classify/v2/logo';
3234
const LOGO_ADD_PATH = '/rest/2.0/realtime_search/v1/logo/add';
3335
const LOGO_DELETE_PATH = '/rest/2.0/realtime_search/v1/logo/delete';
@@ -118,6 +120,40 @@ class AipImageClassify extends BaseClient {
118120
return this.commonImpl(objectTools.merge(param, options));
119121
}
120122

123+
/**
124+
* 车辆检测接口
125+
*
126+
* @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
127+
* @param {Object} options - 可选参数对象,key: value都为string类型
128+
* @description options - options列表:
129+
* show 是否返回结果图(含统计值和跟踪框)。选true时返回渲染后的图片(base64),其它无效值或为空则默认false。
130+
* area 只统计该区域内的车辆数,缺省时为全图统计。<br>逗号分隔,如‘x1,y1,x2,y2,x3,y3...xn,yn',按顺序依次给出每个顶点的x、y坐标(默认尾点和首点相连),形成闭合多边形区域。<br>服务会做范围(顶点左边需在图像范围内)及个数校验(数组长度必须为偶数,且大于3个顶点)。只支持单个多边形区域,建议设置矩形框,即4个顶点。**坐标取值不能超过图像宽度和高度,比如1280的宽度,坐标值最大到1279**。
131+
* @return {Promise} - 标准Promise对象
132+
*/
133+
vehicleDetect(image, options) {
134+
let param = {
135+
image: image,
136+
targetPath: VEHICLE_DETECT_PATH
137+
};
138+
return this.commonImpl(objectTools.merge(param, options));
139+
}
140+
141+
/**
142+
* 车辆外观损伤识别接口
143+
*
144+
* @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
145+
* @param {Object} options - 可选参数对象,key: value都为string类型
146+
* @description options - options列表:
147+
* @return {Promise} - 标准Promise对象
148+
*/
149+
vehicleDamage(image, options) {
150+
let param = {
151+
image: image,
152+
targetPath: VEHICLE_DAMAGE_PATH
153+
};
154+
return this.commonImpl(objectTools.merge(param, options));
155+
}
156+
121157
/**
122158
* logo商标识别接口
123159
*

src/AipNlp.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const TOPIC_PATH = '/rpc/2.0/nlp/v1/topic';
3939
const ECNET_PATH = '/rpc/2.0/nlp/v1/ecnet';
4040
const EMOTION_PATH = '/rpc/2.0/nlp/v1/emotion';
4141
const NEWS_SUMMARY_PATH = '/rpc/2.0/nlp/v1/news_summary';
42+
const ADDRESS_PATH = '/rpc/2.0/nlp/v1/address';
4243

4344

4445
/**
@@ -303,6 +304,22 @@ class AipNlp extends BaseClient {
303304
};
304305
return this.commonImpl(objectTools.merge(param, options));
305306
}
307+
308+
/**
309+
* 地址识别接口接口
310+
*
311+
* @param {string} text - 待识别的文本内容,不超过1000字节
312+
* @param {Object} options - 可选参数对象,key: value都为string类型
313+
* @description options - options列表:
314+
* @return {Promise} - 标准Promise对象
315+
*/
316+
address(text, options) {
317+
let param = {
318+
text: text,
319+
targetPath: ADDRESS_PATH
320+
};
321+
return this.commonImpl(objectTools.merge(param, options));
322+
}
306323
}
307324

308325
module.exports = AipNlp;

src/client/task.js

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)