Skip to content
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

Merge/main to develop #4439

Merged
merged 79 commits into from
May 29, 2024
Merged

Merge/main to develop #4439

merged 79 commits into from
May 29, 2024

Conversation

findtopher
Copy link
Member

@findtopher findtopher commented May 29, 2024

What changes are proposed in this pull request?

Merge Main to Develop after v0.24.0 release

Summary by CodeRabbit

  • New Features

    • Introduced grid configuration options in the 3D viewer.
    • Added support for convex hull rendering in detection overlays.
    • Enhanced dataset documentation with a new 3D dataset "Quickstart 3D".
    • Added new roles and permissions page for admin users.
  • Bug Fixes

    • Fixed login errors and improved URL expiration configuration.
  • Improvements

    • Updated grid and point cloud rendering logic for better performance.
    • Enhanced tooltip customization in the app.
    • Refined dataset access permissions for groups.
  • Documentation

    • Updated release notes for FiftyOne Teams 1.7.0 and FiftyOne 0.24.0.
    • Added new sections and images to the user guide.
  • Tests

    • Modified test cases to include assertions for new metadata fields in 3D projections.

patrontheo and others added 30 commits April 25, 2024 00:51
fix: coco category ids can now be not sequential - avoiding memory leak
Adding custom runs plugin and minor tweaks
fix absolute css position for view bar icons
* convert to timezone only if datetime is tzaware; add exposing test
* WIP 3D export fixes and tests

* print

* errant copypasta

* move rewrite asset logic to scene_3d

* cleanup 3d import/export tests a bit
Support non-sequential COCO category IDs
* add np casting to json encoder

* isinstance

* add test

* add await
tweak zoom and workspace right alignment [v0.24.0]
* handle state payload in useRefresh

* cleanup

* skip e2e refresh

* cleanup, comment
* fix multi pcd e2e

* fix media visibility toggler e2e
* bug: use name arg in lights

* add null checking when computing camera props

* upgrade three.js deps

* default name arg to class name in base class
Copy link
Contributor

coderabbitai bot commented May 29, 2024

Walkthrough

This update introduces significant enhancements across various components, focusing on improving grid configuration, 3D visualization, and dataset management. Key changes include new state management for grid properties, updated projection metadata, refined detection overlays, and expanded dataset documentation. Additionally, the update includes performance optimizations, bug fixes, and new features like customizable user roles and 3D dataset support.

Changes

File(s) Change Summary
app/packages/components/src/components/PopoutSectionTitle/PopoutSectionTitle.tsx Added flexbox styling for alignment and spacing.
app/packages/looker-3d/src/action-bar/ToggleGridHelper.tsx Enhanced grid configuration with new state atoms, components, and conditional rendering logic.
app/packages/looker-3d/src/action-bar/shared.tsx Refactored ActionPopOver component to use forwardRef for better ref management.
app/packages/looker-3d/src/action-bar/style.module.css Added new CSS classes for grid configuration layout and alignment.
app/packages/looker-3d/src/fo3d/Gizmos.tsx Updated grid and scene size calculations, added Recoil state management for grid settings, and adjusted grid component props.
app/packages/looker-3d/src/fo3d/point-cloud/Pcd.tsx Updated point loader logic, added memoization, and included a commented-out block for centering points.
app/packages/looker-3d/src/fo3d/point-cloud/use-pcd-material.tsx Added a key prop to the <RgbShader> component.
app/packages/looker-3d/src/hooks/use-pcd-material-controls.ts Increased maximum point size value and added a comment about adding a text box for user input.
app/packages/looker-3d/src/state.ts Introduced new atom declarations for managing grid-related state.
app/packages/looker/src/overlays/detection.ts Added convexHull property to DetectionLabel and updated rendering logic to draw convex hulls.
app/packages/looker/src/state.ts Updated OrthogrpahicProjectionMetadata type to include normal, min_bound, and max_bound fields with three numbers each.
app/packages/looker/src/worker/label-3d-projection-utils.test.ts Added test cases for the projectTo2D function to project 3D points onto 2D planes.
app/packages/looker/src/worker/label-3d-projection-utils.ts Introduced utility functions for working with 3D and 2D bounding boxes, including projection and rotation functions.
app/packages/looker/src/worker/threed-label-processor.ts Added imports for convex hull calculation and updated bounding box projection logic.
docs/source/release-notes.rst Updated release notes for FiftyOne Teams 1.7.0 and FiftyOne 0.24.0, detailing new features, fixes, and improvements.
docs/source/teams/roles_and_permissions.rst Refined dataset access permissions for groups and added a new section on the Roles page for admins.
docs/source/user_guide/app.rst Added and removed images related to the App, and included information about customizing tooltip attributes.
docs/source/user_guide/dataset_zoo/datasets.rst Introduced a new section for the "Quickstart 3D" dataset with details on its contents and usage.
docs/source/user_guide/using_datasets.rst Added explanations on dataset media types, persistence, versioning, custom color schemes, and orthographic projection images for 3D datasets.
e2e-pw/scripts/generate-screenshots-docker-image/build-docker-image.sh Excluded additional directories during rsync operation and added a step to build a Docker image named screenshot.
fiftyone/core/labels.py Clarified the map_path parameter in the Heatmap class to specify it as the absolute path to the heatmap image on disk.
fiftyone/core/session/session.py Removed asdict import and added _pull_group_slice function for group slicing logic.
fiftyone/core/threed/scene_3d.py Updated Scene class with example usage code, modified __repr__ method, and clarified docstrings.
fiftyone/operators/executor.py Modified set_progress method to update logging behavior for progress and label information.
fiftyone/utils/super_gradients.py Refactored _convert_yolo_nas_detection_model function, adjusted model loading logic for GPU usage, and renamed _predict_all to predict with a new predict_all method for batch prediction.
fiftyone/utils/utils3d.py Added normal field to OrthographicProjectionMetadata class, and added padding parameter to projection functions to apply relative padding around the point cloud before projection.
fiftyone/zoo/datasets/base.py Added Quickstart3DDataset class representing a small 3D dataset with meshes, point clouds, and oriented bounding boxes, including methods for downloading, preparing, and parsing dataset metadata.
setup.py Changed version specification for the Jinja2 package from >=3 to ==3.0.3.
tests/unittests/utils3d_tests.py Modified test_orthographic_projection_metadata_field to include assertions for the normal field in the metadata and field objects.

Poem

In the code where grids align,
New atoms and states do shine.
Projections clear, bounding boxes true,
Detection overlays, a fresh view.
With datasets rich, roles refined,
A leap in features, so well designed.
🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Outside diff range and nitpick comments (15)
app/packages/looker/src/worker/threed-label-processor.ts (1)

111-165: The logic for determining the projection plane based on the normal vector and the subsequent calculation of projected corners is well-implemented. However, consider adding more comments to explain the logic behind the projection plane determination and the impact of different normals on the projection results. This will improve maintainability and understandability of the code.

fiftyone/core/threed/scene_3d.py (1)

116-138: The example usage provided in the documentation is clear and demonstrates how to use the Scene class effectively. This is helpful for new users who are integrating 3D scene management into their projects. Consider adding a bit more detail on the role of each method called in the example for better clarity.

fiftyone/operators/executor.py (3)

Line range hint 160-160: Avoid using bare except statements.

Using bare except statements can catch unexpected exceptions, which can obscure underlying bugs. Specify the exception type to improve error handling.

- except:
+ except Exception as e:

Line range hint 365-365: Unused local variable e.

The variable e is assigned but never used, which is unnecessary and can be removed for cleaner code.

- except Exception as e:
+ except Exception:

Line range hint 886-886: Use direct boolean checks instead of comparing to True.

Instead of comparing a boolean to True, you can use the value directly in conditions. This makes the code cleaner and more Pythonic.

- if not error.custom == True:
+ if not error.custom:
fiftyone/utils/utils3d.py (4)

440-440: Ensure that the normal field is properly documented to reflect its usage and default behavior.

Consider enhancing the documentation for the normal field to clearly state that it defaults to [0, 0, 1] if not specified. This helps in understanding the expected behavior without diving into the code.


Line range hint 538-610: Review the implementation of padding in compute_orthographic_projection_images.

The padding calculation seems overly complex and could be simplified. Additionally, the function is quite long and handles multiple responsibilities. Consider refactoring to improve readability and maintainability.

- padding (None): a relative padding(s) in ``[0, 1]]`` to apply to the
-     field of view bounds prior to projection. Can either be a single
-     value to apply in all directions or a ``[padx, pady, padz]``. For
-     example, pass ``padding=0.25`` with no ``bounds`` to project onto
-     a tight crop of each point cloud with 25% padding around it
+ padding (None): a relative padding in ``[0, 1]`` to apply uniformly in all directions. For
+     example, pass ``padding=0.25`` to apply 25% padding around the bounds.

Consider breaking down the function into smaller, more focused sub-functions to handle specific parts of the projection process.


Line range hint 692-731: Validate the padding parameter in compute_orthographic_projection_image.

The function accepts a padding parameter that can be a list or a single value, but there's no validation to ensure the input is within the expected format or range. Adding input validation can prevent runtime errors and ensure the function behaves as expected.

+ if isinstance(padding, list) and len(padding) != 3:
+     raise ValueError("Padding must be a single float or a list of three floats.")
+ if isinstance(padding, float) and not (0 <= padding <= 1):
+     raise ValueError("Padding value must be between 0 and 1.")

Line range hint 847-903: Optimize the padding and bounds calculation in _parse_point_cloud.

The padding and bounds calculation can be optimized and made more clear. Consider extracting this logic into a separate method to improve modularity and readability.

- if padding is not None:
-     pad = 0.5 * np.asarray(padding) * (max_bound - min_bound)
-     min_bound -= pad
-     max_bound += pad
+ def apply_padding(bounds, padding):
+     if padding is not None:
+         pad = 0.5 * np.asarray(padding) * (bounds[1] - bounds[0])
+         bounds = (bounds[0] - pad, bounds[1] + pad)
+     return bounds
+ min_bound, max_bound = apply_padding((min_bound, max_bound), padding)
fiftyone/core/session/session.py (5)

Line range hint 27-27: Replace the bare except with a specific exception or handle the exception more gracefully.

- except:
+ except ImportError:

Line range hint 527-527: Replace the bare except with a specific exception or handle the exception more gracefully.

- except:
+ except Exception as e:
+     logger.error("An error occurred: %s", str(e))

Line range hint 1149-1151: Replace lambda expressions with def functions for better readability and debugging.

- on_close_session: t.Callable[[CloseSession], None] = lambda _: setattr(
-     session, "_wait_closed", True
- )
+ def on_close_session(_: CloseSession) -> None:
+     setattr(session, "_wait_closed", True)

Also applies to: 1154-1156, 1159-1161, 1164-1166, 1169-1171, 1174-1176, 1179-1181, 1186-1192, 1195-1199


Line range hint 1234-1234: Consider using importlib.util.find_spec to check for the availability of fiftyone.desktop instead of importing it directly.

- import fiftyone.desktop
+ from importlib import util
+ if util.find_spec("fiftyone.desktop") is not None:
+     import fiftyone.desktop
+ else:
+     raise ImportError("fiftyone.desktop is not installed")

Line range hint 1299-1299: Replace bare except with a specific exception or handle the exception more gracefully.

- except:
+ except Exception as e:
+     logger.error("An error occurred while writing JSON: %s", str(e))

Also applies to: 1309-1309

fiftyone/zoo/datasets/base.py (1)

Line range hint 636-636: Refactor to avoid bare except statements.

Using bare except statements can catch unexpected exceptions and obscure programming errors. It's recommended to catch specific exceptions. Here's a suggested refactor:

- except:
+ except Exception as e:
+     logger.error("An error occurred: %s", str(e))

Also applies to: 643-643, 3360-3360, 3368-3368, 3376-3376, 3383-3383

Review Details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits Files that changed from the base of the PR and between f2720c8 and fabe783.
Files ignored due to path filters (17)
  • app/packages/looker/package.json is excluded by !**/*.json
  • app/yarn.lock is excluded by !**/*.lock, !**/*.lock
  • docs/source/images/app/app-empty.gif is excluded by !**/*.gif, !**/*.gif
  • docs/source/images/app/app-empty.png is excluded by !**/*.png, !**/*.png
  • docs/source/images/app/app-expanded.gif is excluded by !**/*.gif, !**/*.gif
  • docs/source/images/app/app-filters.gif is excluded by !**/*.gif, !**/*.gif
  • docs/source/images/app/app-scroll.gif is excluded by !**/*.gif, !**/*.gif
  • docs/source/images/app/app-scrollable-tooltip.gif is excluded by !**/*.gif, !**/*.gif
  • docs/source/images/app/app-views1.gif is excluded by !**/*.gif, !**/*.gif
  • docs/source/images/dataset_zoo/quickstart-3d.png is excluded by !**/*.png, !**/*.png
  • docs/source/images/datasets/quickstart-3d.gif is excluded by !**/*.gif, !**/*.gif
  • docs/source/images/datasets/quickstart-groups.gif is excluded by !**/*.gif, !**/*.gif
  • docs/source/images/datasets/quickstart-video.gif is excluded by !**/*.gif, !**/*.gif
  • docs/source/images/datasets/quickstart.gif is excluded by !**/*.gif, !**/*.gif
  • docs/source/images/teams/admin_roles_page.png is excluded by !**/*.png, !**/*.png
  • e2e-pw/src/oss/specs/3d/fo3d-pcd-stl.spec.ts-snapshots/scene-chromium-darwin.png is excluded by !**/*.png, !**/*.png
  • e2e-pw/src/oss/specs/3d/fo3d-pcd-stl.spec.ts-snapshots/scene-chromium-linux.png is excluded by !**/*.png, !**/*.png
Files selected for processing (29)
  • app/packages/components/src/components/PopoutSectionTitle/PopoutSectionTitle.tsx (1 hunks)
  • app/packages/looker-3d/src/action-bar/ToggleGridHelper.tsx (1 hunks)
  • app/packages/looker-3d/src/action-bar/shared.tsx (1 hunks)
  • app/packages/looker-3d/src/action-bar/style.module.css (1 hunks)
  • app/packages/looker-3d/src/fo3d/Gizmos.tsx (5 hunks)
  • app/packages/looker-3d/src/fo3d/point-cloud/Pcd.tsx (2 hunks)
  • app/packages/looker-3d/src/fo3d/point-cloud/use-pcd-material.tsx (1 hunks)
  • app/packages/looker-3d/src/hooks/use-pcd-material-controls.ts (1 hunks)
  • app/packages/looker-3d/src/state.ts (1 hunks)
  • app/packages/looker/src/overlays/detection.ts (2 hunks)
  • app/packages/looker/src/state.ts (1 hunks)
  • app/packages/looker/src/worker/label-3d-projection-utils.test.ts (1 hunks)
  • app/packages/looker/src/worker/label-3d-projection-utils.ts (1 hunks)
  • app/packages/looker/src/worker/threed-label-processor.ts (5 hunks)
  • docs/source/release-notes.rst (2 hunks)
  • docs/source/teams/roles_and_permissions.rst (2 hunks)
  • docs/source/user_guide/app.rst (3 hunks)
  • docs/source/user_guide/dataset_zoo/datasets.rst (2 hunks)
  • docs/source/user_guide/using_datasets.rst (12 hunks)
  • e2e-pw/scripts/generate-screenshots-docker-image/build-docker-image.sh (1 hunks)
  • fiftyone/core/labels.py (1 hunks)
  • fiftyone/core/session/session.py (3 hunks)
  • fiftyone/core/threed/scene_3d.py (6 hunks)
  • fiftyone/operators/executor.py (1 hunks)
  • fiftyone/utils/super_gradients.py (4 hunks)
  • fiftyone/utils/utils3d.py (13 hunks)
  • fiftyone/zoo/datasets/base.py (2 hunks)
  • setup.py (1 hunks)
  • tests/unittests/utils3d_tests.py (2 hunks)
Files skipped from review due to trivial changes (5)
  • app/packages/components/src/components/PopoutSectionTitle/PopoutSectionTitle.tsx
  • docs/source/user_guide/dataset_zoo/datasets.rst
  • docs/source/user_guide/using_datasets.rst
  • fiftyone/core/labels.py
  • setup.py
Additional Context Used
ShellCheck (1)
e2e-pw/scripts/generate-screenshots-docker-image/build-docker-image.sh (1)

[info] 24-24: Use ./glob or -- glob so names with dashes won't become options.

Ruff (31)
fiftyone/core/session/session.py (14)

27-27: Do not use bare except


527-527: Do not use bare except


1149-1151: Do not assign a lambda expression, use a def


1154-1156: Do not assign a lambda expression, use a def


1159-1161: Do not assign a lambda expression, use a def


1164-1166: Do not assign a lambda expression, use a def


1169-1171: Do not assign a lambda expression, use a def


1174-1176: Do not assign a lambda expression, use a def


1179-1181: Do not assign a lambda expression, use a def


1186-1192: Do not assign a lambda expression, use a def


1195-1199: Do not assign a lambda expression, use a def


1234-1234: fiftyone.desktop imported but unused; consider using importlib.util.find_spec to test for availability


1299-1299: Do not use bare except


1309-1309: Do not use bare except

fiftyone/operators/executor.py (6)

160-160: Do not use bare except


271-271: Do not use bare except


278-278: Do not use bare except


365-365: Local variable e is assigned to but never used


392-392: Local variable e is assigned to but never used


886-886: Avoid inequality comparisons to True; use if not error.custom: for false checks

fiftyone/utils/super_gradients.py (5)

16-16: Module level import not at top of file


16-16: torch imported but unused


17-17: Module level import not at top of file


132-132: Ambiguous variable name: l


136-136: Ambiguous variable name: l

fiftyone/zoo/datasets/base.py (6)

636-636: Do not use bare except


643-643: Do not use bare except


3360-3360: Do not use bare except


3368-3368: Do not use bare except


3376-3376: Do not use bare except


3383-3383: Do not use bare except

Biome (53)
app/packages/looker-3d/src/action-bar/ToggleGridHelper.tsx (3)

5-6: The default import is only used as a type.


118-118: This hook does not specify all of its dependencies: isFirstLoad


118-118: This hook does not specify all of its dependencies: setIsGridOn

app/packages/looker-3d/src/action-bar/shared.tsx (1)

1-2: The default import is only used as a type.

app/packages/looker-3d/src/fo3d/Gizmos.tsx (2)

123-123: This hook does not specify all of its dependencies: setCellSize


123-123: This hook does not specify all of its dependencies: setSectionSize

app/packages/looker-3d/src/fo3d/point-cloud/Pcd.tsx (2)

3-4: All these imports are only used as types.


5-6: All these imports are only used as types.

app/packages/looker-3d/src/fo3d/point-cloud/use-pcd-material.tsx (4)

26-26: Unexpected any. Specify a different type.


1-2: All these imports are only used as types.


9-10: All these imports are only used as types.


71-71: This hook specifies more dependencies than necessary: geometry

app/packages/looker-3d/src/hooks/use-pcd-material-controls.ts (2)

1-2: All these imports are only used as types.


11-12: All these imports are only used as types.

app/packages/looker-3d/src/state.ts (3)

1-1: All these imports are only used as types.


4-5: All these imports are only used as types.


5-6: All these imports are only used as types.

app/packages/looker/src/overlays/detection.ts (8)

195-195: The assignment should not be in an expression.


204-204: The assignment should not be in an expression.


292-301: Prefer for...of instead of forEach.


6-7: All these imports are only used as types.


7-8: All these imports are only used as types.


9-10: Some named imports are only used as types.


194-194: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead.


201-201: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead.

app/packages/looker/src/state.ts (10)

120-120: Unexpected any. Specify a different type.


129-129: This enum declaration contains members that are implicitly initialized.


187-187: Unexpected any. Specify a different type.


322-322: Unexpected any. Specify a different type.


411-411: Unexpected any. Specify a different type.


493-493: Unexpected any. Specify a different type.


4-5: All these imports are only used as types.


5-6: All these imports are only used as types.


6-7: All these imports are only used as types.


8-9: All these imports are only used as types.

app/packages/looker/src/worker/label-3d-projection-utils.test.ts (1)

1-2: Some named imports are only used as types.

app/packages/looker/src/worker/threed-label-processor.ts (17)

147-147: Declare variables separately


147-147: This variable implicitly has the any type.


201-203: Prefer for...of instead of forEach.


1-1: Some named imports are only used as types.


3-4: All these imports are only used as types.


4-5: All these imports are only used as types.


5-9: Some named imports are only used as types.


37-37: Use Number.Infinity instead of the equivalent global.


38-38: Use Number.Infinity instead of the equivalent global.


39-39: Use Number.Infinity instead of the equivalent global.


40-40: Use Number.Infinity instead of the equivalent global.


70-70: Use Number.Infinity instead of the equivalent global.


71-71: Use Number.Infinity instead of the equivalent global.


74-74: Use Number.Infinity instead of the equivalent global.


77-77: Use Number.Infinity instead of the equivalent global.


83-83: Use Number.Infinity instead of the equivalent global.


86-86: Use Number.Infinity instead of the equivalent global.

Path-based Instructions (12)
app/packages/looker-3d/src/action-bar/shared.tsx (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

app/packages/looker/src/worker/label-3d-projection-utils.test.ts (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

app/packages/looker-3d/src/fo3d/point-cloud/Pcd.tsx (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

app/packages/looker/src/worker/label-3d-projection-utils.ts (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

app/packages/looker-3d/src/state.ts (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

app/packages/looker-3d/src/hooks/use-pcd-material-controls.ts (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

app/packages/looker-3d/src/fo3d/point-cloud/use-pcd-material.tsx (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

app/packages/looker-3d/src/action-bar/ToggleGridHelper.tsx (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

app/packages/looker-3d/src/fo3d/Gizmos.tsx (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

app/packages/looker/src/worker/threed-label-processor.ts (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

app/packages/looker/src/overlays/detection.ts (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

app/packages/looker/src/state.ts (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

Learnings (1)
app/packages/looker-3d/src/fo3d/Gizmos.tsx (1)
User: sashankaryal
PR: voxel51/fiftyone#4310
File: app/packages/looker-3d/src/fo3d/Gizmos.tsx:110-0
Timestamp: 2024-04-25T21:03:45.341Z
Learning: The grid rendering logic in `Gizmos.tsx` is part of an external component and not directly modifiable within the project's codebase.
Additional comments not posted (29)
app/packages/looker-3d/src/action-bar/shared.tsx (1)

4-15: Refactor to use forwardRef correctly enhances component reusability.

The use of forwardRef allows the ActionPopOver component to accept a ref that can be forwarded to a DOM element, which is useful for managing focus, selection, or animations.

app/packages/looker/src/worker/label-3d-projection-utils.test.ts (1)

4-22: Comprehensive unit tests for projectTo2D function.

The tests cover projections to all three planes (xz, xy, yz), ensuring that the function behaves as expected across different scenarios.

e2e-pw/scripts/generate-screenshots-docker-image/build-docker-image.sh (2)

24-28: Improve rsync command safety by preventing potential option interpretation.
[REFACTOR_SUGGESTion]

- rsync -aq "$FIFTYONE_ROOT_DIR"/* --exclude-from '.gitignore' \
+ rsync -aq -- "$FIFTYONE_ROOT_DIR"/* --exclude-from '.gitignore' \

Adding -- before specifying the source directory ensures that filenames starting with a dash are not interpreted as options, enhancing the script's robustness.


32-32: Docker image build step added to the script.

This step is crucial for ensuring that the Docker environment is prepared with the latest changes, facilitating consistent testing across environments.

app/packages/looker-3d/src/action-bar/style.module.css (1)

38-64: Enhanced CSS for grid configuration layout.

The use of flexbox in .gridConfigContainer and .gridLabel improves the layout's responsiveness and alignment, which is beneficial for maintaining a clean and scalable UI.

app/packages/looker-3d/src/fo3d/point-cloud/Pcd.tsx (1)

35-39: Address potential issues with cloning in useLoader.

The comment indicates a workaround for a cloning issue. It's important to verify if this issue has been resolved in the library to potentially simplify the code.

app/packages/looker/src/worker/label-3d-projection-utils.ts (1)

19-83: Enhanced utility functions for 3D to 2D projections.

The functions rotatePoint and getProjectedCorners are well-implemented, providing robust tools for handling 3D geometries and their projection to 2D planes, which are essential for accurate rendering and analysis in 3D visualization contexts.

app/packages/looker-3d/src/state.ts (1)

60-63: Ensure proper initialization and usage of Recoil atoms.

All newly introduced atoms (gridCellSizeAtom, gridSectionSizeAtom, isGridInfinitelyLargeAtom, gridSizeAtom, shouldGridFadeAtom) are correctly defined with appropriate defaults and keys. Make sure these atoms are used consistently across the application.

Also applies to: 65-68, 70-78, 80-83, 86-94

fiftyone/utils/super_gradients.py (1)

52-52: Ensure correct model configuration for YOLO-NAS.

The configuration for the YOLO-NAS model appears to be set correctly. This change should enable the use of YOLO-NAS models within the FiftyOne framework effectively.

app/packages/looker-3d/src/fo3d/point-cloud/use-pcd-material.tsx (1)

112-112: Ensure the key prop is used correctly in the <RgbShader> component.

The addition of the key prop to the <RgbShader> component is a good practice to ensure that React correctly reconciles the list of components when the state changes. This change should help in maintaining performance and correctness.

app/packages/looker-3d/src/action-bar/ToggleGridHelper.tsx (1)

20-110: Review the implementation of the GridConfigurator and ToggleGridHelper components.

The GridConfigurator and ToggleGridHelper components are well-implemented with clear and concise logic for handling grid configuration and toggling. The use of Recoil for state management in these components is appropriate and follows best practices.

app/packages/looker-3d/src/fo3d/Gizmos.tsx (1)

141-165: Ensure the grid fading logic is correctly implemented.

The grid fading logic, including the calculation of fade distance and strength, is implemented correctly. This feature enhances the visual quality of the grid by making it less obtrusive at greater distances.

app/packages/looker/src/worker/threed-label-processor.ts (2)

Line range hint 72-89: The addition of a third dimension to the min_bound and max_bound fields, and the introduction of a normal field in OrthogrpahicProjectionMetadata are significant changes that align with the PR's objectives to enhance 3D visualization capabilities. Ensure that all dependent functionalities are updated to handle these new dimensions correctly.


167-171: The implementation of the convex hull calculation using the monotone-convex-hull-2d library is a good choice for efficiency. However, ensure that the newProjectedCorners array always contains at least three points before calling ch, as the convex hull algorithm requires at least three points to compute a meaningful result.

Verification successful

The corners array is populated with the eight corners of a 3D bounding box, ensuring that transformedCorners, projectedCorners, and consequently newProjectedCorners will always have at least eight points. Therefore, the convex hull calculation using the monotone-convex-hull-2d library is safe and will always have sufficient points to compute a meaningful result.

  • corners is defined with eight points.
  • transformedCorners is derived from corners.
  • projectedCorners is derived from transformedCorners.
  • newProjectedCorners is derived from projectedCorners.

Thus, newProjectedCorners will always contain at least eight points.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that newProjectedCorners always contains at least three points.

# Test: Search for the function usage. Expect: At least three points in newProjectedCorners.
rg --type python $'newProjectedCorners.length >= 3'

Length of output: 83



Script:

#!/bin/bash
# Description: Verify that newProjectedCorners always contains at least three points.

# Search for the definition and usage of newProjectedCorners in TypeScript files.
rg 'newProjectedCorners' --type ts

# Search for conditions checking the length of newProjectedCorners.
rg 'newProjectedCorners.length' --type ts

Length of output: 446



Script:

#!/bin/bash
# Description: Extract the relevant code around the definition of newProjectedCorners and projectedCorners.

# Extract lines around the definition of newProjectedCorners.
rg 'const newProjectedCorners' --type ts -A 10 -B 10

# Extract lines around the definition of projectedCorners.
rg 'const projectedCorners' --type ts -A 10 -B 10

Length of output: 3237



Script:

#!/bin/bash
# Description: Extract the relevant code around the definition of transformedCorners.

# Extract lines around the definition of transformedCorners.
rg 'const transformedCorners' --type ts -A 10 -B 10

Length of output: 1954



Script:

#!/bin/bash
# Description: Extract the relevant code around the definition of corners.

# Extract lines around the definition of corners.
rg 'const corners' --type ts -A 10 -B 10

Length of output: 2063

app/packages/looker/src/overlays/detection.ts (1)

233-254: The implementation of fillRectFor3d to draw the convex hull of the projected corners is a robust addition for handling 3D bounding boxes. The use of transparency and double stroke width enhances the visibility of the convex hull. Ensure that the convexHull array is always correctly populated and validated before this method is called to avoid runtime errors.

docs/source/teams/roles_and_permissions.rst (1)

112-113: The clarification on how access levels are limited by user roles within groups is a valuable addition for understanding permission boundaries in FiftyOne Teams. This helps in setting clear expectations for role-based access control.

app/packages/looker/src/state.ts (1)

68-70: The addition of a third dimension to the min_bound and max_bound fields, and the introduction of a normal field in OrthogrpahicProjectionMetadata are consistent with the changes in threed-label-processor.ts. This ensures that the state management is aligned with the 3D data handling enhancements.

fiftyone/core/threed/scene_3d.py (1)

386-393: The method for loading a scene from an .fo3d file is correctly implemented with appropriate error handling for file extension validation. This ensures that the function behaves predictably and errors are caught early.

tests/unittests/utils3d_tests.py (2)

288-288: Added assertion for the normal field in OrthographicProjectionMetadata.

This ensures that the new field is correctly serialized and deserialized, maintaining data integrity across operations.


308-308: Added assertion for the normal field in the dataset sample.

This is a good practice to ensure that the new field is correctly handled in practical scenarios, not just theoretically in the metadata class.

fiftyone/operators/executor.py (3)

Line range hint 271-271: Avoid using bare except statements.


Line range hint 278-278: Avoid using bare except statements.


Line range hint 392-392: Unused local variable e.

fiftyone/core/session/session.py (1)

1322-1331: The function _pull_group_slice is a new addition and correctly handles the optional parameters for dataset and view. It uses the properties group_slice from both dataset and view to determine the appropriate return value.

docs/source/user_guide/app.rst (2)

56-59: Updated image for the FiftyOne App documentation.

This change updates the image to presumably a more current or relevant screenshot, which should help users better understand the app's interface.


1094-1107: Added tooltip customization instructions.

This addition provides users with guidance on how to customize tooltips in the FiftyOne App, enhancing the documentation's utility by addressing a specific user interaction with the app.

fiftyone/zoo/datasets/base.py (1)

3182-3204: Add a new class for a small 3D dataset.

The addition of Quickstart3DDataset class provides a small 3D dataset with meshes, point clouds, and oriented bounding boxes, which is a valuable resource for quick demonstrations or testing of 3D data handling capabilities.

docs/source/release-notes.rst (2)

6-135: The release notes are well-documented and provide a comprehensive overview of the updates in FiftyOne Teams 1.7.0 and FiftyOne 0.24.0. The inclusion of pull request links enhances traceability.


2713-2714: The additions to the release notes are clear and concise. Please ensure that the reference links are correctly linked and functional.

Verification successful

The reference links in the release notes are correctly linked and functional.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the reference links in the release notes are correctly linked and functional.

# Test: Search for the reference links in the documentation. Expect: Correctly linked and functional references.
rg --type rst $':ref:'

Length of output: 215573

Comment on lines +429 to +430
normal (None): the normal vector of the plane onto which the projection
was performed. If not specified, ``[0, 0, 1]`` is assumed
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a default value for the normal field in OrthographicProjectionMetadata.

- normal (None): the normal vector of the plane onto which the projection
-     was performed. If not specified, ``[0, 0, 1]`` is assumed
+ normal (None): the normal vector of the plane onto which the projection
+     was performed. If not specified, ``[0, 0, 1]`` is assumed
+ normal = fof.ListField(fof.FloatField(), default=[0, 0, 1])

Committable suggestion was skipped due low confidence.

Comment on lines +37 to +38
// max point size is arbitrary. ideally, we should also offer a text box for users to input their desired point size
max: 50,
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding a user input for point size customization.

The comment on line 37 suggests adding a text box for user input to set the point size. This would enhance user interaction by allowing them to specify a custom point size. Consider implementing this feature to improve usability.

@@ -1,11 +1,15 @@
import { ActionPopOverDiv, ActionPopOverInner } from "../containers";
import React, { forwardRef } from "react";
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using type-only imports for React.

- import React, { forwardRef } from "react";
+ import type { ForwardRefRenderFunction } from "react";
+ import { forwardRef } from "react";

This change ensures that React is only imported for its type definitions where needed, aligning with best practices for cleaner and more efficient code.


Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
import React, { forwardRef } from "react";
import type { ForwardRefRenderFunction } from "react";
import { forwardRef } from "react";

Comment on lines +1 to +2
import { describe, expect, it } from "vitest";
import { Vec3, projectTo2D } from "./label-3d-projection-utils";
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using type-only imports for test utilities.

- import { describe, expect, it } from "vitest";
+ import type { Describe, Expect, It } from "vitest";
+ import { describe, expect, it } from "vitest";

This change ensures that test utilities are only imported for their type definitions where needed, which can help in reducing the final bundle size if tree-shaking is not effectively configured.

Committable suggestion was skipped due low confidence.

@brimoor brimoor merged commit 8df4426 into develop May 29, 2024
17 checks passed
@brimoor brimoor deleted the merge/main-to-develop branch May 29, 2024 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.