Skip to content

Commit 251fa45

Browse files
authored
Merge branch 'development' into release
2 parents a6695de + ef7ee72 commit 251fa45

File tree

18 files changed

+662
-244
lines changed

18 files changed

+662
-244
lines changed

.all-contributorsrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,15 @@
659659
"doc",
660660
"content"
661661
]
662+
},
663+
{
664+
"login": "badunit",
665+
"name": "Fabio Corona",
666+
"avatar_url": "https://avatars2.githubusercontent.com/u/44651201?v=4",
667+
"profile": "https://github.com/badunit",
668+
"contributions": [
669+
"bug"
670+
]
662671
}
663672
],
664673
"contributorsPerLine": 7,

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ![ml5](https://user-images.githubusercontent.com/10605821/41332516-2ee26714-6eac-11e8-83e4-a40b8761e764.png)
2-
[![All Contributors](https://img.shields.io/badge/all_contributors-61-orange.svg?style=flat-square)](#contributors)
2+
[![All Contributors](https://img.shields.io/badge/all_contributors-62-orange.svg?style=flat-square)](#contributors)
33

44

55
[![BrowserStack Status](https://www.browserstack.com/automate/badge.svg?badge_key=QVNDdlkvMzNYSmhRRWlweXlIOTBENkd0MDBCOUJlbmFVZFRneFIzNlh4az0tLXA4S0loSGNlVUc2V2I3cVdLdXBKdGc9PQ==--8a5e5bfd3eafbba0702c02ec57ffec9d627a78ef)](https://www.browserstack.com/automate/public-build/QVNDdlkvMzNYSmhRRWlweXlIOTBENkd0MDBCOUJlbmFVZFRneFIzNlh4az0tLXA4S0loSGNlVUc2V2I3cVdLdXBKdGc9PQ==--8a5e5bfd3eafbba0702c02ec57ffec9d627a78ef)[![Version](https://img.shields.io/npm/v/ml5.svg?style=flat-square)](https://www.npmjs.com/package/ml5)
@@ -173,6 +173,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
173173
<td align="center"><a href="http://yangyang.blog"><img src="https://avatars3.githubusercontent.com/u/9332910?v=4" width="100px;" alt="Yang"/><br /><sub><b>Yang</b></sub></a><br /><a href="https://github.com/ml5js/ml5-library/commits?author=EonYang" title="Code">💻</a> <a href="https://github.com/ml5js/ml5-library/issues?q=author%3AEonYang" title="Bug reports">🐛</a></td>
174174
<td align="center"><a href="https://github.com/lydiajessup"><img src="https://avatars3.githubusercontent.com/u/26204298?v=4" width="100px;" alt="Lydia Jessup"/><br /><sub><b>Lydia Jessup</b></sub></a><br /><a href="https://github.com/ml5js/ml5-library/commits?author=lydiajessup" title="Code">💻</a> <a href="#ideas-lydiajessup" title="Ideas, Planning, & Feedback">🤔</a> <a href="#example-lydiajessup" title="Examples">💡</a></td>
175175
<td align="center"><a href="https://coding.garden"><img src="https://avatars0.githubusercontent.com/u/14241866?v=4" width="100px;" alt="CJ R."/><br /><sub><b>CJ R.</b></sub></a><br /><a href="https://github.com/ml5js/ml5-library/commits?author=w3cj" title="Documentation">📖</a> <a href="#content-w3cj" title="Content">🖋</a></td>
176+
<td align="center"><a href="https://github.com/badunit"><img src="https://avatars2.githubusercontent.com/u/44651201?v=4" width="100px;" alt="Fabio Corona"/><br /><sub><b>Fabio Corona</b></sub></a><br /><a href="https://github.com/ml5js/ml5-library/issues?q=author%3Abadunit" title="Bug reports">🐛</a></td>
176177
</tr>
177178
</table>
178179

docs/reference/bodypix.md

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,23 @@ bodyPix.segment(?input, ?options, callback)
197197

198198
📤 **Outputs**
199199

200-
* **Object**: Returns an Object. "{raw}", "{maskBackground}", and "{maskPerson}". The returns will either be a UInt8 array corresponding to the image array or a p5Image if p5.js is available.
200+
* **Object**: Returns an Object. The returns will either be a UInt8 array corresponding to the image array or a p5Image if p5.js is available.
201+
*
202+
```js
203+
{
204+
segmentation,
205+
raw: {
206+
personMask: null,
207+
backgroundMask: null,
208+
},
209+
tensor: {
210+
personMask: null,
211+
backgroundMask: null,
212+
},
213+
personMask: null,
214+
backgroundMask: null,
215+
};
216+
```
201217
202218
***
203219
@@ -220,7 +236,27 @@ bodyPix.segmentWithParts(?input, ?options, callback)
220236

221237
📤 **Outputs**
222238

223-
* **Object**: Returns an Object. "{raw}". The returns will either be a UInt8 array corresponding to the image array or a p5Image if p5.js is available.
239+
* **Object**: Returns an Object. The returns will either be a UInt8 array corresponding to the image array or a p5Image if p5.js is available.
240+
241+
```js
242+
{
243+
segmentation: *ImageData*,
244+
raw: {
245+
personMask: *ImageData*,
246+
backgroundMask: *ImageData*,
247+
partMask: *ImageData*
248+
},
249+
tensor: {
250+
personMask: *Tensor*,
251+
backgroundMask: *Tensor*,
252+
partMask: *Tensor*,
253+
},
254+
personMask: *P5Image*,
255+
backgroundMask: *P5Image*,
256+
partMask: *P5Image*,
257+
bodyParts: *JSONObject*
258+
}
259+
```
224260
225261
***
226262

docs/reference/unet.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,28 @@ unet.segment(?video, ?callback);
8181
8282
📤 **Outputs**
8383
84-
* **Object**: Returns an array of objects. Each object contains `{something, anotherThing}`.
84+
* **Object**: Returns an Object.
85+
```js
86+
{
87+
segmentation:mask,
88+
blob: {
89+
featureMask: *Blob*,
90+
backgroundMask: *Blob*
91+
},
92+
tensor: {
93+
featureMask: *Tensor*,
94+
backgroundMask: *Tensor*,
95+
},
96+
raw: {
97+
featureMask: *ImageData*,
98+
backgroundMask: *ImageData*
99+
},
100+
// returns if p5 is available
101+
featureMask: *p5Image*,
102+
backgroundMask: *p5Image*,
103+
mask: *p5Image*
104+
};
105+
```
85106
86107
***
87108

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"test-travis": "./scripts/test-travis.sh",
1919
"serve:docs": "docsify serve docs",
2020
"update:readme": "node ./scripts/updateReadme.js",
21+
"update:docs": "node ./scripts/updateDocVersions.js $oldversion",
2122
"publish:npm": "npm run build && npm publish"
2223
},
2324
"repository": {

scripts/updateDocVersions.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/**
2+
* USAGE
3+
* run:
4+
*```
5+
*$ oldversion=0.4.2 npm run update:docs
6+
*```
7+
*/
8+
9+
const fs = require('fs');
10+
11+
12+
// ------------------
13+
// Helper functions
14+
// ------------------
15+
function readTextFile(fpath){
16+
const readme = fs.readFileSync(fpath, 'utf8');
17+
return readme;
18+
}
19+
20+
function readPackageJson(fpath){
21+
let output = fs.readFileSync(fpath);
22+
output = JSON.parse(output);
23+
return output;
24+
}
25+
26+
function updateFileVersion(inputFilePath, regex, newUrl){
27+
const readme = readTextFile(inputFilePath);
28+
const updatedReadme = readme.replace(regex, newUrl)
29+
fs.writeFileSync(inputFilePath, updatedReadme);
30+
}
31+
32+
const oldVersion = process.env.oldversion;
33+
const ml5Version = readPackageJson('./package.json').version || 'latest';
34+
const newUrl = `https://unpkg.com/ml5@${ml5Version}/dist/ml5.min.js`;
35+
const regex = new RegExp(`https://unpkg.com/ml5@${oldVersion}/dist/ml5.min.js`, "g");
36+
37+
38+
function make(){
39+
if(!oldVersion) {
40+
console.log("!!!old version needed!!! \n oldversion=0.4.X npm run update:docs");
41+
process.exit(1);
42+
}
43+
44+
updateFileVersion('./docs/README.md', regex, newUrl);
45+
updateFileVersion('./docs/tutorials/hello-ml5.md', regex, newUrl);
46+
47+
console.log(`updated docs from version ${oldVersion} to ${ml5Version}`)
48+
}
49+
make();
50+
51+
52+
53+
54+

src/BodyPix/BODYPIX_PALETTE.js

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
export default {
2+
// "none": {
3+
// "id": -1,
4+
// "color": [0, 0, 0]
5+
// },
6+
"leftFace": {
7+
"id": 0,
8+
"color": [110, 64, 170]
9+
},
10+
"rightFace": {
11+
"id": 1,
12+
"color": [106, 72, 183]
13+
},
14+
"rightUpperLegFront": {
15+
"id": 2,
16+
"color": [100, 81, 196]
17+
},
18+
"rightLowerLegBack": {
19+
"id": 3,
20+
"color": [92, 91, 206]
21+
},
22+
"rightUpperLegBack": {
23+
"id": 4,
24+
"color": [84, 101, 214]
25+
},
26+
"leftLowerLegFront": {
27+
"id": 5,
28+
"color": [75, 113, 221]
29+
},
30+
"leftUpperLegFront": {
31+
"id": 6,
32+
"color": [66, 125, 224]
33+
},
34+
"leftUpperLegBack": {
35+
"id": 7,
36+
"color": [56, 138, 226]
37+
},
38+
"leftLowerLegBack": {
39+
"id": 8,
40+
"color": [48, 150, 224]
41+
},
42+
"rightFeet": {
43+
"id": 9,
44+
"color": [40, 163, 220]
45+
},
46+
"rightLowerLegFront": {
47+
"id": 10,
48+
"color": [33, 176, 214]
49+
},
50+
"leftFeet": {
51+
"id": 11,
52+
"color": [29, 188, 205]
53+
},
54+
"torsoFront": {
55+
"id": 12,
56+
"color": [26, 199, 194]
57+
},
58+
"torsoBack": {
59+
"id": 13,
60+
"color": [26, 210, 182]
61+
},
62+
"rightUpperArmFront": {
63+
"id": 14,
64+
"color": [28, 219, 169]
65+
},
66+
"rightUpperArmBack": {
67+
"id": 15,
68+
"color": [33, 227, 155]
69+
},
70+
"rightLowerArmBack": {
71+
"id": 16,
72+
"color": [41, 234, 141]
73+
},
74+
"leftLowerArmFront": {
75+
"id": 17,
76+
"color": [51, 240, 128]
77+
},
78+
"leftUpperArmFront": {
79+
"id": 18,
80+
"color": [64, 243, 116]
81+
},
82+
"leftUpperArmBack": {
83+
"id": 19,
84+
"color": [79, 246, 105]
85+
},
86+
"leftLowerArmBack": {
87+
"id": 20,
88+
"color": [96, 247, 97]
89+
},
90+
"rightHand": {
91+
"id": 21,
92+
"color": [115, 246, 91]
93+
},
94+
"rightLowerArmFront": {
95+
"id": 22,
96+
"color": [134, 245, 88]
97+
},
98+
"leftHand": {
99+
"id": 23,
100+
"color": [155, 243, 88]
101+
}
102+
}

0 commit comments

Comments
 (0)