ultralytics 8.0.238 Explorer Ask AI feature and fixes (#7408)
Co-authored-by: Kayzwer <68285002+Kayzwer@users.noreply.github.com> Co-authored-by: uwer <uwe.rosebrock@gmail.com> Co-authored-by: Uwe Rosebrock <ro260@csiro.au> Co-authored-by: Ayush Chaurasia <ayush.chaurarsia@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Laughing-q <1182102784@qq.com> Co-authored-by: Muhammad Rizwan Munawar <chr043416@gmail.com> Co-authored-by: AdamP <adamp87hun@gmail.com>
This commit is contained in:
parent
e76754eab0
commit
783033fa6b
19 changed files with 387 additions and 76 deletions
|
|
@ -119,7 +119,31 @@ You can also plot the similar images using the `plot_similar` method. This metho
|
|||
plt.show()
|
||||
```
|
||||
|
||||
## 2. SQL Querying
|
||||
## 2. Ask AI (Natural Language Querying)
|
||||
|
||||
This allows you to write how you want to filter your dataset using natural language. You don't have to be proficient in writing SQL queries. Our AI powered query generator will automatically do that under the hood. For example - you can say - "show me 100 images with exactly one person and 2 dogs. There can be other objects too" and it'll internally generate the query and show you those results.
|
||||
Note: This works using LLMs under the hood so the results are probabilistic and might get things wrong sometimes
|
||||
|
||||
!!! Example "Ask AI"
|
||||
|
||||
```python
|
||||
from ultralytics import Explorer
|
||||
from ultralytics.data.explorer import plot_query_result
|
||||
|
||||
|
||||
# create an Explorer object
|
||||
exp = Explorer(data='coco128.yaml', model='yolov8n.pt')
|
||||
exp.create_embeddings_table()
|
||||
|
||||
df = exp.ask_ai("show me 100 images with exactly one person and 2 dogs. There can be other objects too")
|
||||
print(df.head())
|
||||
|
||||
# plot the results
|
||||
plt = plot_query_result(df)
|
||||
plt.show()
|
||||
```
|
||||
|
||||
## 3. SQL Querying
|
||||
|
||||
You can run SQL queries on your dataset using the `sql_query` method. This method takes a SQL query as input and returns a pandas dataframe with the results.
|
||||
|
||||
|
|
@ -153,7 +177,7 @@ You can also plot the results of a SQL query using the `plot_sql_query` method.
|
|||
print(df.head())
|
||||
```
|
||||
|
||||
## 3. Working with embeddings Table (Advanced)
|
||||
## 4. Working with embeddings Table (Advanced)
|
||||
|
||||
You can also work with the embeddings table directly. Once the embeddings table is created, you can access it using the `Explorer.table`
|
||||
|
||||
|
|
@ -210,7 +234,7 @@ When using large datasets, you can also create a dedicated vector index for fast
|
|||
|
||||
Find more details on the type vector indices available and parameters [here](https://lancedb.github.io/lancedb/ann_indexes/#types-of-index) In the future, we will add support for creating vector indices directly from Explorer API.
|
||||
|
||||
## 4. Embeddings Applications
|
||||
## 5. Embeddings Applications
|
||||
|
||||
You can use the embeddings table to perform a variety of exploratory analysis. Here are some examples:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue