Socket
Socket
Sign inDemoInstall

sap-leonardo

Package Overview
Dependencies
48
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.5.4 to 0.5.5

4

CHANGELOG.md

@@ -5,2 +5,6 @@ # CHANGELOG

## 0.5.5
- Inference Service for Customizable Object Detection
- adjust timeout for ocr test
## 0.5.4

@@ -7,0 +11,0 @@ - typo in Inference Service for Topic Detection

@@ -16,1 +16,2 @@ export * from "./imageclassification";

export * from "./topic_detection";
export * from "./object_detection";

@@ -21,1 +21,2 @@ "use strict";

__export(require("./topic_detection"));
__export(require("./object_detection"));

64

dist/test/test_object_detection.js

@@ -7,64 +7,14 @@ "use strict";

const fileName = "juice-1271881_640.jpg";
describe("multi-instance image segmentation", () => {
describe("object detection", () => {
const objectDetection = new index_1.ObjectDetection(process.env.API_KEY);
describe("four items", () => {
it("should predict three bottles and a can", (done) => {
describe("juice", () => {
it("should predict something, but causes an internal error", (done) => {
objectDetection.objectDetection("./testdata/" + fileName).then((body) => {
console.log(JSON.stringify(body, null, " "));
chai_1.expect(body).to.have.property("id");
chai_1.expect(body).to.have.property("predictions").which.is.an("array").with.length(1);
chai_1.expect(body).to.have.property("processedTime");
chai_1.expect(body).to.have.property("status").to.be.equal("DONE");
// expect(body.predictions[0]).to.have.property("imageName").which.is.equal(fileName);
// expect(body.predictions[0]).to.have.property("results").is.an("array").with.length(4);
// for (let i = 0; i < expectedResults.length; i++) {
// expect(body.predictions[0].results[i].bbox).to.be.eql(expectedResults[i].bbox);
// expect(body.predictions[0].results[i].classId).to.be.equal(expectedResults[i].classId);
// expect(body.predictions[0].results[i].className).to.be.equal(expectedResults[i].className);
// expect(body.predictions[0].results[i].score).to.be.equal(expectedResults[i].score);
// // encoded mask data should have the size of bbox width * height
// const encodedMaskData = Buffer.from(body.predictions[0].results[i].mask, "base64");
// const bbox = body.predictions[0].results[i].bbox;
// const bboxWidth = Math.abs(bbox.x2 - bbox.x1);
// const bboxHeight = Math.abs(bbox.y2 - bbox.y1);
// expect(encodedMaskData.length).to.be.equal(bboxWidth * bboxHeight);
// }
chai_1.expect(body).to.have.property("fault");
chai_1.expect(body.fault).to.have.property("detail");
chai_1.expect(body.fault.detail).to.have.property("errorcode");
chai_1.expect(body.fault.detail.errorcode).to.be.equal("messaging.adaptors.http.flow.ApplicationNotFound");
}).then(done, done);
}).timeout(60000);
});
describe("multi-instance image segmentation image:jpg", () => {
describe("return image", () => {
it("should return a png image", (done) => {
objectDetection.objectDetection("./testdata/" + fileName, true).then((body) => {
console.log(JSON.stringify(body, null, " "));
chai_1.expect(body).to.have.property("id");
chai_1.expect(body).to.have.property("predictions").is.an("array").with.length(1);
chai_1.expect(body).to.have.property("processedTime");
chai_1.expect(body).to.have.property("status").to.be.equal("DONE");
// expect(body.predictions[0]).to.have.property("imageName").is.equal(fileName);
// // fs.writeFileSync(
// // "MultiInstanceImageSegmentation.png",
// // Buffer.from(body.predictions[0].imageString, "base64"));
// const encodedImageData = Buffer.from(body.predictions[0].imageString, "base64");
// const isJPG =
// encodedImageData[0] === 0xFF &&
// encodedImageData[1] === 0xD8 &&
// encodedImageData[2] === 0xFF;
// const isPNG =
// encodedImageData[0] === 0x89 &&
// encodedImageData[1] === 0x50 &&
// encodedImageData[2] === 0x4E &&
// encodedImageData[3] === 0x47 &&
// encodedImageData[4] === 0x0D &&
// encodedImageData[5] === 0x0A &&
// encodedImageData[6] === 0x1A &&
// encodedImageData[7] === 0x0A;
// // tslint:disable-next-line:no-unused-expression
// expect(isJPG).is.false;
// // tslint:disable-next-line:no-unused-expression
// expect(isPNG).is.true;
}).then(done, done);
}).timeout(60000);
});
});
describe("error coverage", () => {

@@ -71,0 +21,0 @@ it("should return a file not found error", (done) => {

@@ -7,2 +7,3 @@ "use strict";

const ocr = new index_1.OCR(process.env.API_KEY);
const timeout = 40000;
describe("image to text", () => {

@@ -20,3 +21,3 @@ it("should return an English text", (done) => {

}).then(done, done);
}).timeout(30000);
}).timeout(timeout);
});

@@ -34,3 +35,3 @@ describe("image to text with options", () => {

}).then(done, done);
}).timeout(30000);
}).timeout(timeout);
it("should return a German text", (done) => {

@@ -46,3 +47,3 @@ const options = { lang: "de", outputType: "txt", pageSegMode: "1", modelType: "lstmStandard" };

}).then(done, done);
}).timeout(30000);
}).timeout(timeout);
});

@@ -49,0 +50,0 @@ describe("image to text (via job)", () => {

{
"name": "sap-leonardo",
"version": "0.5.4",
"version": "0.5.5",
"description": "NPM module for SAP Leonardo Machine Learning Foundation - Functional Services https://api.sap.com/package/SAPLeonardoMLFunctionalServices",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -44,3 +44,3 @@ # SAP Leonardo Machine Learning Foundation - Functional Services

Following services (with a link) are implemented:
### Following services are implemented:

@@ -54,23 +54,18 @@ - [Inference Service For Customizable Image Feature Extraction](https://api.sap.com/api/img_feature_extraction_api/resource)

- [Inference Service for Machine Translation](https://api.sap.com/api/translation_api/resource)
- ~~Training Service for Customizable Object Detection~~
- [Inference Service for Similarity Scoring](https://api.sap.com/api/similarity_scoring_api/resource)
- [Inference Service for Customizable Image Classification](https://api.sap.com/api/image_classification_api/resource)
- ~~decommissioned: Time Series Changepoint Detection API~~
- ~~Time Series Changepoint Detection API~~ (decommissioned)
- [Product Image Classification API](https://api.sap.com/api/product_image_classification_api/resource)
- ~~Training Service for Customizable Similarity Search~~
- ~~Inference Service for Customizable Similarity Search~~
- [Inference Service for Topic Detection](https://api.sap.com/api/topic_detection_api/resource)
- [Inference Service for Human Detection](https://api.sap.com/api/human_detection_api/resource)
- [Inference Service for Face Detection](https://api.sap.com/api/face_detection_api/resource)
- [Inference Service for Language Detection](https://api.sap.com/api/language_detection_api/resource)
- [Inference Service for Customizable Object Detection](https://api.sap.com/api/object_detection_api/resource) (not implemented)
- [Inference Service for Optical Character Recognition (OCR)](https://api.sap.com/api/ocr_api/resource)
### Following services require a training instance (not implemented)
- ~~Training Service for Customizable Object Detection~~
- ~~Training Service for Customizable Similarity Search~~
- ~~Inference Service for Customizable Similarity Search~~
- ~~Training Service for Customizable Text Classification~~
- [Inference Service for Customizable Object Detection](https://api.sap.com/api/object_detection_api/resource) (not implemted)
- [Inference Service for Optical Character Recognition (OCR)](https://api.sap.com/api/ocr_api/resource)
- ~~Inference Service for Customizable Text Classification~~

@@ -109,3 +104,3 @@ - ~~Training Service For Customizable Image Classification and Feature Extraction~~

## Image Sources
## Testdata Sources

@@ -122,2 +117,6 @@ - [testdata/elephant-114543_*.jpg](https://pixabay.com/en/elephant-african-bush-elephant-114543/)

- [keyboard-70506_640.jpg](https://pixabay.com/en/keyboard-computer-hardware-keys-70506/)
- topic_detection.zip:
- https://en.wikipedia.org/wiki/Apple_pie
- https://en.wikipedia.org/wiki/Computer_science
- https://en.wikipedia.org/wiki/Computational_complexity_theory

@@ -124,0 +123,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc