-
Notifications
You must be signed in to change notification settings - Fork 0
QJ PERCEPTION MODEL
QJ Robots Python SDK provides powerful machine vision perception capabilities, supporting object detection, image segmentation, attribute description, angle prediction, keypoint detection, and grasp point prediction for 2D/3D images.
- Python 3.x
- Dependencies: requests>=2.26.0, python-dotenv>=0.19.0
pip install py-qj-robotsThe following environment variables need to be configured before using the SDK:
- QJ_APP_ID: Application ID
- QJ_APP_SECRET: Application Secret
You can click here to obtain your Application ID and Secret.
You can configure these variables in two ways:
- Create a .env file:
QJ_APP_ID=your_app_id
QJ_APP_SECRET=your_app_secret
- Using export command:
export QJ_APP_ID=your_app_id
export QJ_APP_SECRET=your_app_secretfrom dotenv import load_dotenv
from py_qj_robots import Perception
import os
# Load environment variables
load_dotenv()
# Initialize Perception instance
perception = Perception()
# Perform 2D image detection
result = perception.check_image(
image_type="2D",
image_url="http://example.com/image.jpg",
object_names=["bottle", "cup"]
)
print(f"Detection result: {result}")Detect target objects in the image.
def check_image(image_type: str, image_url: str, object_names: Union[str, List[str]], depth_url: Optional[str] = None) -> DictParameters:
- image_type: Image type, '2D' or '3D'
- image_url: Image URL
- object_names: Names of objects to detect, can be a string or list of strings
- depth_url: Depth image URL (required only when image_type is '3D')
Segment target objects in the image.
def split_image(image_type: str, image_url: str, object_names: Union[str, List[str]], depth_url: Optional[str] = None) -> DictReturn value includes:
- boxes: Bounding box coordinates [x1,y1,x2,y2]
- masks: Mask image URLs and data
- croppedImagesListBbox: Cropped image URLs
- labels: Detected object labels
- scores: Confidence scores
Get attribute descriptions of objects in the image.
def props_describe(image_type: str, image_url: str, object_names: Union[str, List[str]], questions: Union[str, List[str]], depth_url: Optional[str] = None) -> DictPredict object angles.
def angle_prediction(image_type: str, image_url: str, object_names: Union[str, List[str]], depth_url: Optional[str] = None) -> DictPredict object keypoints.
def key_point_prediction(image_type: str, image_url: str, object_names: Union[str, List[str]], depth_url: Optional[str] = None) -> DictPredict object grasp points.
def grab_point_prediction(image_type: str, image_url: str, object_names: Union[str, List[str]], depth_url: Optional[str] = None) -> DictPerform complete perception analysis, including all features.
def full_perception(image_type: str, image_url: str, object_names: Union[str, List[str]], questions: Union[str, List[str]], depth_url: Optional[str] = None) -> DictReturn value includes all perception results:
- angles: Angle information
- boxes: Bounding boxes
- masks: Segmentation masks
- points: Keypoints
- grasps: Grasp points
- answers: Attribute descriptions
- etc.
Visit QJ Robots Official Website for more information.