Skip to content

Commit 9a57672

Browse files
committed
change to featureExtractor to work as a method and not a class
1 parent 70f174f commit 9a57672

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/FeatureExtractor/index.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ General Feature Extractor Manager
1010
import Mobilenet from './Mobilenet';
1111

1212
/* eslint max-len: ["error", { "code": 180 }] */
13-
const FeatureExtractor = (model, optionsOrCallback, cb = () => {}) => {
13+
const featureExtractor = (model, optionsOrCallback, cb = () => {}) => {
1414
let modelName;
1515
if (typeof model !== 'string') {
16-
console.error('Please specify a model to use. E.g: "Mobilenet"');
16+
throw new Error('Please specify a model to use. E.g: "MobileNet"');
1717
} else {
1818
modelName = model.toLowerCase();
1919
}
@@ -30,8 +30,7 @@ const FeatureExtractor = (model, optionsOrCallback, cb = () => {}) => {
3030
if (modelName === 'mobilenet') {
3131
return new Mobilenet(options, callback);
3232
}
33-
console.error(`${modelName} is not a valid model.`);
34-
return null;
33+
throw new Error(`${modelName} is not a valid model.`);
3534
};
3635

37-
export default FeatureExtractor;
36+
export default featureExtractor;

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import * as tf from '@tensorflow/tfjs';
77
import Crepe from './Crepe/';
88
import imageClassifier from './ImageClassifier/';
9-
import FeatureExtractor from './FeatureExtractor/';
9+
import featureExtractor from './FeatureExtractor/';
1010
import Word2Vec from './Word2vec/';
1111
import YOLO from './YOLO';
1212
import PoseNet from './PoseNet';
@@ -16,7 +16,7 @@ import LSTMGenerator from './LSTM/';
1616

1717
module.exports = {
1818
imageClassifier,
19-
FeatureExtractor,
19+
featureExtractor,
2020
Crepe,
2121
YOLO,
2222
Word2Vec,

0 commit comments

Comments
 (0)