pf-robotics / kachaka-api

スマートファニチャープラットフォーム「カチャカ」API
https://kachaka.zendesk.com/hc/ja/articles/7660222791183-%E3%82%AB%E3%83%81%E3%83%A3%E3%82%ABAPI
Apache License 2.0
85 stars 24 forks source link

update api add samples for transfer learning #86

Closed kmurase-pfr closed 5 months ago

kmurase-pfr commented 5 months ago

カチャカソフトウェア v2.7.8 からサポートされる転移学習用のAPI公開と、サンプルを公開します。

coderabbitai[bot] commented 5 months ago

Walkthrough

この変更は、オブジェクト検出機能を扱うための新しいメッセージタイプ、応答メッセージタイプ、およびRPCメソッドをkachaka-api.protoに追加すること、依存関係にonnxruntimeを追加すること、オブジェクト検出を使用した推論と特徴保存のためのPythonノートブックの導入、そしてAPIの非同期および同期メソッドの拡張を含む、オブジェクト検出機能の取得と活用を目的とした一連の変更です。

Changes

ファイルパス 変更概要
protos/kachaka-api.proto 新しいメッセージタイプObjectDetectionFeatures、応答メッセージタイプGetObjectDetectionFeaturesResponse、およびRPCメソッドGetObjectDetectionFeaturesを追加
python/demos/requirements.txt 依存関係にonnxruntime==1.17.0を追加
python/demos/run_custom_object_detection.ipynb
python/demos/save_object_detection_features.ipynb
オブジェクト検出を使用した推論と特徴保存のためのPythonノートブックを導入
python/kachaka_api/aio/__init__.py
python/kachaka_api/aio/base.py
python/kachaka_api/base.py
オブジェクト検出機能の取得と関連コールバックのための機能を追加
python/kachaka_api/generated/kachaka_api_pb2.pyi
python/kachaka_api/generated/kachaka_api_pb2_grpc.py
スロット属性の変更、新しいメソッドGetObjectDetectionFeaturesの追加と対応する機能の調整
python/kachaka_api/util/vision.py ユーザー定義ラベルを使用して画像上にバウンディングボックスを描画する新しい関数get_bbox_drawn_image_with_user_labelsを追加

Recent Review Status **Configuration used: CodeRabbit UI**
Commits Files that changed from the base of the PR and between 3cac018c9030f8edd1a4daf4923a737721827389 and 5d9593fd3efc9c63413ec655d337b1ee6ca01f4a.
Files selected for processing (11) * protos/kachaka-api.proto (3 hunks) * python/demos/requirements.txt (1 hunks) * python/demos/run_custom_object_detection.ipynb (1 hunks) * python/demos/save_object_detection_features.ipynb (1 hunks) * python/kachaka_api/aio/__init__.py (1 hunks) * python/kachaka_api/aio/base.py (1 hunks) * python/kachaka_api/base.py (1 hunks) * python/kachaka_api/generated/kachaka_api_pb2.py (3 hunks) * python/kachaka_api/generated/kachaka_api_pb2.pyi (27 hunks) * python/kachaka_api/generated/kachaka_api_pb2_grpc.py (4 hunks) * python/kachaka_api/util/vision.py (2 hunks)
Files not summarized due to errors (1) * python/kachaka_api/generated/kachaka_api_pb2.py: Error: Message exceeds token limit
Files not reviewed due to errors (1) * (no review received)
Additional comments not posted (16)
python/demos/requirements.txt (1)
`17-17`: `onnxruntime==1.17.0` の追加は、転移学習機能の強化に必要な依存関係であるため、問題ありません。
python/kachaka_api/util/vision.py (1)
`39-66`: `get_bbox_drawn_image_with_user_labels` 関数の追加は、ユーザー定義のラベルを持つバウンディングボックスを画像に描画する機能を提供し、問題ありません。
python/demos/save_object_detection_features.ipynb (1)
`1-91`: `save_object_detection_features.ipynb` ノートブックは、転移学習用のオブジェクト検出機能を保存する方法を示すためのものであり、問題ありません。
python/demos/run_custom_object_detection.ipynb (1)
`1-93`: `run_custom_object_detection.ipynb` ノートブックは、カスタムオブジェクト検出モデルを使用して推論を実行する方法を示すためのものであり、問題ありません。
python/kachaka_api/aio/__init__.py (1)
`124-133`: `object_detection_features` 属性と関連するコールバック機能の追加は、転移学習機能の強化に必要な機能であり、問題ありません。
protos/kachaka-api.proto (3)
`227-231`: `ObjectDetectionFeatures` メッセージタイプの追加は、オブジェクト検出機能の取得と処理をサポートするために必要です。 --- `328-331`: `GetObjectDetectionFeaturesResponse` メッセージタイプの追加は、オブジェクト検出機能の応答形式を定義するために適切です。 --- `555-555`: `GetObjectDetectionFeatures` RPCメソッドの追加は、オブジェクト検出機能の効率的な通信とデータ交換を可能にします。
python/kachaka_api/base.py (1)
`67-74`: `get_object_detection_features` メソッドの追加は、オブジェクト検出機能を取得するために必要な機能であり、問題ありません。
python/kachaka_api/generated/kachaka_api_pb2.py (3)
`84-85`: `ObjectDetectionFeatures`メッセージタイプが正しく追加されています。これは、転移学習機能をサポートするためのPRの目的に沿っています。 --- `120-121`: `GetObjectDetectionFeaturesResponse`メッセージタイプが正しく追加されています。これは、オブジェクト検出機能の取得をサポートするAPIの拡張を示しています。 --- `24-33`: 追加された列挙型(`LocationType`, `ShelfAppearance`, `ShelfSpeedMode`, `ObjectLabel`, `CommandState`)は、APIの転移学習とオブジェクト検出タスクのサポートを強化するPRの目的に沿っています。定義は正しく、一般的なprotobufの列挙型定義と一致しています。
python/kachaka_api/generated/kachaka_api_pb2.pyi (2)
`10-10`: `__slots__`属性を空のリストから空のタプルに変更することで、メモリ効率が向上します。この変更は、クラスインスタンスのメモリ使用量を削減するための一般的なPythonの最適化手法です。 --- `662-817`: > :memo: **NOTE** > This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [16-853] すべてのクラスで`__slots__`属性が空のリストから空のタプルに変更されています。これは、クラスインスタンスのメモリ使用量を削減し、パフォーマンスを向上させるための効果的な方法です。この変更により、特に大量のインスタンスが生成される場合にメモリ効率が向上します。
python/kachaka_api/generated/kachaka_api_pb2_grpc.py (2)
`43-47`: 新しいメソッド`GetObjectDetectionFeatures`がクライアントスタブに正しく追加されました。この変更により、クライアントはオブジェクト検出機能を非同期に取得できるようになります。 --- `459-463`: `GetObjectDetectionFeatures`メソッドがサーバー登録関数に正しく追加されました。これにより、サーバーはこの新しいRPCメソッドを適切に処理できるようになります。
---
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `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.` 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 a review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@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](https://docs.coderabbit.ai/guides/configure-coderabbit) 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](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.