You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+55-12
Original file line number
Diff line number
Diff line change
@@ -116,28 +116,71 @@ Key files and classes include:
116
116
117
117
The SDK wraps the GraphQL APIs and provides a Pythonic interface for interacting with Labelbox.
118
118
119
+
## Contribution guidelines
120
+
We encourage developers to contribute to the Labelbox Python SDK and help improve its functionality and usability. Please refer to the `CONTRIB.md` file in the root folder of the repository for detailed information on how to contribute.
121
+
122
+
## Develop with AI assistance
123
+
### Load this repo code as context for large language models
124
+
Using the [GPT repository loader](https://github.com/mpoon/gpt-repository-loader), we have created `lbx_prompt.txt` that contains data from all `.py` and `.md` files. The file has about 730k tokens. We recommend using Gemini 1.5 Pro with 1 million context length window
125
+
126
+
### Ask Google Gemini to get started
119
127
120
-
## Extending the SDK
128
+
####Extending the SDK
121
129
The Labelbox Python SDK is designed to be extensible. Here are examples of how you can extend the SDK:
122
130
123
-
### Adding an Export Format Converter
131
+
##### Adding an Export Format Converter
132
+
###### Adding a method to convert export v2 to COCO format in Labelbox Python SDK
133
+
134
+
To add a method to the Labelbox Python SDK that converts export v2 into COCO format, you can follow these steps:
135
+
136
+
**1. Create a new Python file:**
137
+
138
+
Create a new file named `coco_converter.py` inside the `labelbox/schema/` directory. This file will contain the logic for converting export v2 data to COCO format.
139
+
140
+
**2. Implement the conversion logic:**
141
+
142
+
Inside `coco_converter.py`, define a function named `export_v2_to_coco`. This function should accept the export v2 data as input and perform the necessary conversion steps to generate the COCO format data structures. You can utilize existing libraries like `pycocotools` to achieve this.
143
+
144
+
Here's a basic example of how the function might look:
124
145
125
-
You can add a new export format converter by creating a class that inherits from the `Converter` class and implements the `convert` method. For example, to add a converter for a custom JSON format:
146
+
```python
147
+
from labelbox.schema.export_task import ExportTask
Open the `labelbox/utilities.py` file and import the newly created `export_v2_to_coco` function. Then, add the function as a method to the `Utilities` class:
We encourage developers to contribute to the Labelbox Python SDK and help improve its functionality and usability. Please refer to the `CONTRIB.md` file in the root folder of the repository for detailed information on how to contribute.
175
+
**4. Update the documentation:**
137
176
138
-
## Develop with AI assistance
139
-
### Load this repo code as context for large language models
140
-
Using the [GPT repository loader](https://github.com/mpoon/gpt-repository-loader), we have created `lbx_prompt.txt` that contains data from all `.py` and `.md` files. The file has about 730k tokens. We recommend using Gemini 1.5 Pro with 1 million context length window
177
+
Modify the README.md file to include information about the new `export_v2_to_coco` method in the `client.utilities` section. This will help users understand how to use the new functionality.
178
+
179
+
**5. Test the implementation:**
180
+
181
+
Write unit tests for the `export_v2_to_coco` function to ensure it works as expected with different export v2 data structures. This will help maintain the quality and reliability of the SDK.
182
+
183
+
By following these steps, you can successfully add a method to the Labelbox Python SDK that converts export v2 data to COCO format, making it readily available for users through `client.utilities.export_v2_to_coco()`.
141
184
142
185
## Documentation
143
186
The Labelbox Python SDK is well-documented to help developers get started quickly and use the SDK effectively. Here are some resources:
0 commit comments