Skip to content

Add linting rules for tfjs-models. #333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Oct 25, 2019
Merged

Add linting rules for tfjs-models. #333

merged 9 commits into from
Oct 25, 2019

Conversation

nsthorat
Copy link

@nsthorat nsthorat commented Oct 24, 2019

  • Adds lint rules to mirror monorepo
  • Fixes lint errors
  • Adds CI to run lint
  • Refactors body pix and posenet to simplify base models for resnet / mobilenet.

This change is Reviewable

Copy link
Contributor

@oveddan oveddan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad this is finally happening!

Another PR in the future could run linting on the demos as part of CI.

Reviewable status: 0 of 1 approvals obtained (waiting on @nsthorat)


body-pix/src/base_model.ts, line 32 at r1 (raw file):

 * added to BodyPix.
 */
export abstract class BaseModel {

Awesome refactoring!

@nsthorat nsthorat requested a review from dsmilkov October 24, 2019 22:04
Copy link
Contributor

@dsmilkov dsmilkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really really nice cleanup!!

Reviewed 24 of 36 files at r1, 55 of 56 files at r2.
Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @dsmilkov and @nsthorat)


body-pix/src/mobilenet.ts, line 38 at r2 (raw file):

// tslint:disable-next-line:no-any
export function assertValidResolution(resolution: any, outputStride: number) {

looks like a lot of code went away (didn't move). Were these unused methods?

Copy link
Contributor

@tylerzhu-github tylerzhu-github left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @dsmilkov and @nsthorat)


body-pix/src/base_model.ts, line 64 at r2 (raw file):

   * - partHeatmaps: A Tensor3D that represents the body part segmentation.
   */
  predict(input: tf.Tensor3D): {

Do we need to specify return type here?


body-pix/src/base_model.ts, line 96 at r2 (raw file):

  // Because MobileNet and ResNet predict() methods output a different order for
  // these values, we have a method that needs to be implemented to order them.
  abstract nameOutputResults(results: tf.Tensor3D[]): {

Do we need to specify return type here?


body-pix/src/mobilenet.ts, line 38 at r2 (raw file):

Previously, dsmilkov (Daniel Smilkov) wrote…

looks like a lot of code went away (didn't move). Were these unused methods?

It's good. All the validation is now performed at the body_pix_model.ts level (1 level higher).

@tylerzhu-github
Copy link
Contributor

Thx LGTM for the changes under body-pix/

Copy link
Author

@nsthorat nsthorat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @dsmilkov, @nsthorat, and @tylerzhu-github)


body-pix/src/base_model.ts, line 64 at r2 (raw file):

Previously, tylerzhu-github (tylerzhu-github) wrote…

Do we need to specify return type here?

In general it's better to have a stricter return type. This allows people who call predict() to know what comes out (and also prevents against string typos).


body-pix/src/base_model.ts, line 96 at r2 (raw file):

Previously, tylerzhu-github (tylerzhu-github) wrote…

Do we need to specify return type here?

See above.


body-pix/src/mobilenet.ts, line 38 at r2 (raw file):

Previously, tylerzhu-github (tylerzhu-github) wrote…

It's good. All the validation is now performed at the body_pix_model.ts level (1 level higher).

Ack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants