ml5js / ml5-next-gen

Repo for next generation of ml5.js: friendly machine learning for the web! 🤖
https://ml5js.org/
Other
95 stars 23 forks source link

Added `bodySegmentation.getPartsId()` #219

Closed alanvww closed 1 month ago

alanvww commented 1 month ago

@shiffman @ziyuan-linn As we discussed in https://github.com/ml5js/ml5-website-v02-docsify/issues/88 & https://github.com/ml5js/ml5-next-gen/pull/139 , this PR is to wrap the palette in a public method called getPartsId() within the bodySegmentation. This method will return an object containing all the constants as key-value pairs, similar to the getSkeleton() method in BodyPose. CleanShot 2024-10-14 at 15 06 00@2x As we are removing the properties section from the model documentation page, this public method ensures that the data remains accessible to all users and aligns with the consistency of other models.

shiffman commented 1 month ago

Fantastic! This will go along well with #211 as well! I hope to add that soon as I will be recording a faceMesh video tutorial next.

shiffman commented 1 month ago

@gohai since this continues your work from #139 I thought I'd check with you to review before merging. Thank you!

gohai commented 1 month ago

This looks good to me @alanvww.

One stylistic nitpick: in the example, one line is missing the trailing semicolon

In #139, we added two constants to MediaPipeSelfieSegmentation as well. I am thinking it's probably best to remove them with the change now. https://github.com/ml5js/ml5-next-gen/blob/aa05f67b9302658394e5a67b2d5aab4586d3434a/src/BodySegmentation/index.js#L189

alanvww commented 1 month ago

This looks good to me @alanvww.

One stylistic nitpick: in the example, one line is missing the trailing semicolon

In #139, we added two constants to MediaPipeSelfieSegmentation as well. I am thinking it's probably best to remove them with the change now.

https://github.com/ml5js/ml5-next-gen/blob/aa05f67b9302658394e5a67b2d5aab4586d3434a/src/BodySegmentation/index.js#L189

Thanks, @gohai! I’ll commit the changes soon. Regarding the constants in SelfieSegmentation, I double-check that there aren’t any current examples using them. However, even if we remove them, it might be a good idea to add more documentation about those properties? @shiffman @MOQN

alanvww commented 1 month ago

@gohai @shiffman Thanks for the reviews! I’ve just made the changes to the code format, removing the selfie segmentation constants.

shiffman commented 1 month ago

Fantastic work, thank you! Merging! I may have some more thoughts or questions when I get to recording a video tutorial about this, stay tuned!