Skip to content

Commit ec5ce45

Browse files
authored
Improve README's. (tensorflow#429)
1 parent 1a67150 commit ec5ce45

File tree

16 files changed

+27
-27
lines changed

16 files changed

+27
-27
lines changed

blazeface/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Note that this package specifies `@tensorflow/tfjs-core` and `@tensorflow/tfjs-c
3131
To import in npm:
3232

3333
```js
34-
import * as blazeface from '@tensorflow-models/blazeface';
34+
const blazeface = require('@tensorflow-models/blazeface');
3535
```
3636

3737
or as a standalone script tag:

body-pix/README-v1.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ An object containing a width, height, and a binary array with 1 for the pixels t
108108
###### via NPM
109109

110110
```javascript
111-
import * as bodyPix from '@tensorflow-models/body-pix';
111+
const bodyPix = require('@tensorflow-models/body-pix');
112112

113113
const outputStride = 16;
114114
const segmentationThreshold = 0.5;
@@ -228,7 +228,7 @@ An object containing a width, height, and an array with a part id from 0-24 for
228228
###### via NPM
229229

230230
```javascript
231-
import * as bodyPix from '@tensorflow-models/body-pix';
231+
const bodyPix = require('@tensorflow-models/body-pix');
232232

233233
const outputStride = 16;
234234
const segmentationThreshold = 0.5;

body-pix/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ $ npm install @tensorflow-models/body-pix
7373
```
7474

7575
```js
76-
import * as bodyPix from '@tensorflow-models/body-pix';
76+
const bodyPix = require('@tensorflow-models/body-pix');
7777

7878
const img = document.getElementById('image');
7979

coco-ssd/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ There are two main ways to get this model in your JavaScript project: via script
4848
```js
4949
// Note: you do not need to import @tensorflow/tfjs here.
5050

51-
import * as cocoSsd from '@tensorflow-models/coco-ssd';
51+
const cocoSsd = require('@tensorflow-models/coco-ssd');
5252

5353
const img = document.getElementById('img');
5454

deeplab/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ In the first step of semantic segmentation, an image is fed through a pre-traine
1111
To get started, pick the model name from `pascal`, `cityscapes` and `ade20k`, and decide whether you want your model quantized to 1 or 2 bytes (set the `quantizationBytes` option to 4 if you want to disable quantization). Then, initialize the model as follows:
1212

1313
```typescript
14-
import * as tf from '@tensorflow-models/tfjs';
15-
import * as deeplab from '@tensorflow-models/deeplab';
14+
const tf = require('@tensorflow-models/tfjs');
15+
const deeplab = require('@tensorflow-models/deeplab');
1616
const loadModel = async () => {
1717
const modelName = 'pascal'; // set to your preferred model, either `pascal`, `cityscapes` or `ade20k`
1818
const quantizationBytes = 2; // either 1, 2 or 4
@@ -34,7 +34,7 @@ By default, calling `load` initalizes the PASCAL variant of the model quantized
3434
If you would rather load custom weights, you can pass the URL in the config instead:
3535

3636
```typescript
37-
import * as deeplab from '@tensorflow-models/deeplab';
37+
const deeplab = require('@tensorflow-models/deeplab');
3838
const loadModel = async () => {
3939
const url = 'https://tfhub.dev/tensorflow/tfjs-model/deeplab/pascal/1/default/1/model.json?tfjs-format=file';
4040
return await deeplab.load({modelUrl: url});
@@ -49,8 +49,8 @@ You can set the `base` attribute in the argument to `pascal`, `cityscapes` or `a
4949
If you require more careful control over the initialization and behavior of the model (e.g. you want to use your own labelling scheme and colormap), use the `SemanticSegmentation` class, passing a pre-loaded `GraphModel` in the constructor:
5050

5151
```typescript
52-
import * as tfconv from '@tensorflow/tfjs-converter';
53-
import * as deeplab from '@tensorflow-models/deeplab';
52+
const tfconv = require('@tensorflow/tfjs-converter');
53+
const deeplab = require('@tensorflow-models/deeplab');
5454
const loadModel = async () => {
5555
const base = 'pascal'; // set to your preferred model, out of `pascal`,
5656
// `cityscapes` and `ade20k`

facemesh/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Note that this package specifies `@tensorflow/tfjs-core` and `@tensorflow/tfjs-c
3030
To import in npm:
3131

3232
```js
33-
import * as facemesh from '@tensorflow-models/facemesh';
33+
const facemesh = require('@tensorflow-models/facemesh');
3434
```
3535

3636
or as a standalone script tag:

facemesh/demo/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The MediaPipe Facemesh demo shows how to use the MediaPipe Facemesh model to est
99
cd into the demos folder:
1010

1111
```sh
12-
cd facemesh/demos
12+
cd facemesh/demo
1313
```
1414

1515
Install dependencies and prepare the build directory:

handpose/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Note that this package specifies `@tensorflow/tfjs-core` and `@tensorflow/tfjs-c
3434
To import in npm:
3535

3636
```js
37-
import * as handpose from '@tensorflow-models/handpose';
37+
const handpose = require('@tensorflow-models/handpose');
3838
```
3939

4040
or as a standalone script tag:

handpose/demo/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This demo shows how to use the handpose model to detect hands in a video stream.
99
cd into the demos folder:
1010

1111
```sh
12-
cd handpose/demos
12+
cd handpose/demo
1313
```
1414

1515
Install dependencies and prepare the build directory:

knn-classifier/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ You can see example code [here](https://github.com/tensorflow/tfjs-models/tree/m
6767
###### via NPM
6868

6969
```js
70-
import * as tf from '@tensorflow/tfjs';
71-
import * as mobilenetModule from '@tensorflow-models/mobilenet';
72-
import * as knnClassifier from '@tensorflow-models/knn-classifier';
70+
const tf = require('@tensorflow/tfjs');
71+
const mobilenetModule = require('@tensorflow-models/mobilenet');
72+
const knnClassifier = require('@tensorflow-models/knn-classifier');
7373

7474
// Create the classifier.
7575
const classifier = knnClassifier.create();

mobilenet/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ There are two main ways to get this model in your JavaScript project: via script
5050
```js
5151
// Note: you do not need to import @tensorflow/tfjs here.
5252

53-
import * as mobilenet from '@tensorflow-models/mobilenet';
53+
const mobilenet = require('@tensorflow-models/mobilenet');
5454

5555
const img = document.getElementById('img');
5656

posenet/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ It returns a `Promise` that resolves with a **single** `pose`. The `pose` has a
152152
###### via NPM
153153

154154
```javascript
155-
import * as posenet from '@tensorflow-models/posenet';
155+
const posenet = require('@tensorflow-models/posenet');
156156

157157
async function estimatePoseOnImage(imageElement) {
158158
// load the posenet model from a checkpoint
@@ -406,7 +406,7 @@ It returns a `promise` that resolves with an array of `pose`s, each with a confi
406406
###### via NPM
407407

408408
```javascript
409-
import * as posenet from '@tensorflow-models/posenet';
409+
const posenet = require('@tensorflow-models/posenet');
410410

411411
async function estimateMultiplePosesOnImage(imageElement) {
412412
const net = await posenet.load();

qna/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ There are two main ways to get this model in your JavaScript project: via script
4747
```js
4848
// Note: you do not need to import @tensorflow/tfjs here, but make sure you have installed the peer dependencies for tfjs-core and tfjs-converter.
4949

50-
import * as qna from '@tensorflow-models/qna';
50+
const qna = require('@tensorflow-models/qna');
5151

5252
// Load the model.
5353
const model = await qna.load();

speech-commands/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ To use the speech-command recognizer, first create a recognizer instance,
4242
then start the streaming recognition by calling its `listen()` method.
4343

4444
```js
45-
import * as tf from '@tensorflow/tfjs';
46-
import * as speechCommands from '@tensorflow-models/speech-commands';
45+
const tf = require('@tensorflow/tfjs');
46+
const speechCommands = require('@tensorflow-models/speech-commands');
4747

4848
// When calling `create()`, you must provide the type of the audio input.
4949
// The two available options are `BROWSER_FFT` and `SOFT_FFT`.
@@ -132,8 +132,8 @@ shape of the Tensor must match the expectation of the recognizer instance.
132132
E.g.,
133133

134134
```js
135-
import * as tf from '@tensorflow/tfjs';
136-
import * as speechCommands from '@tensorflow-models/speech-commands';
135+
const tf = require('@tensorflow/tfjs');
136+
const speechCommands = require('@tensorflow-models/speech-commands');
137137

138138
const recognizer = speechCommands.create('BROWSER_FFT');
139139

toxicity/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Using `npm`:
2323
To import in npm:
2424

2525
```js
26-
import * as toxicity from '@tensorflow-models/toxicity';
26+
const toxicity = require('@tensorflow-models/toxicity');
2727
```
2828

2929
or as a standalone script tag:

universal-sentence-encoder/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Using `npm`:
3333
To import in npm:
3434

3535
```js
36-
import * as use from '@tensorflow-models/universal-sentence-encoder';
36+
const use = require('@tensorflow-models/universal-sentence-encoder');
3737
```
3838

3939
or as a standalone script tag:

0 commit comments

Comments
 (0)