Fix explorer.md python codeblocks (#18471)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
parent
26ff8b5914
commit
126867e355
1 changed files with 6 additions and 14 deletions
|
|
@ -53,9 +53,7 @@ Pip install `ultralytics` and [dependencies](https://github.com/ultralytics/ultr
|
|||
|
||||
```bash
|
||||
%pip install ultralytics[explorer] openai
|
||||
import ultralytics
|
||||
|
||||
ultralytics.checks()
|
||||
yolo checks
|
||||
```
|
||||
|
||||
## Similarity Search
|
||||
|
|
@ -88,11 +86,9 @@ You can use the also plot the similar samples directly using the `plot_similar`
|
|||
|
||||
```python
|
||||
exp.plot_similar(idx=6500, limit=20)
|
||||
# exp.plot_similar(idx=[100,101], limit=10) # Can also pass list of idxs or imgs
|
||||
exp.plot_similar(idx=[100, 101], limit=10) # Can also pass list of idxs or imgs
|
||||
|
||||
exp.plot_similar(
|
||||
img="https://ultralytics.com/images/bus.jpg", limit=10, labels=False
|
||||
) # Can also pass any external images
|
||||
exp.plot_similar(img="https://ultralytics.com/images/bus.jpg", limit=10, labels=False) # Can also pass external images
|
||||
```
|
||||
|
||||

|
||||
|
|
@ -149,7 +145,7 @@ exp.plot_sql_query("WHERE labels LIKE '%person, person%' AND labels LIKE '%dog%'
|
|||
|
||||
```python
|
||||
table = exp.sql_query("WHERE labels LIKE '%person, person%' AND labels LIKE '%dog%' LIMIT 10")
|
||||
table
|
||||
print(table)
|
||||
```
|
||||
|
||||
Just like similarity search, you also get a util to directly plot the sql queries using `exp.plot_sql_query`
|
||||
|
|
@ -166,7 +162,7 @@ Explorer works on [LanceDB](https://lancedb.github.io/lancedb/) tables internall
|
|||
|
||||
```python
|
||||
table = exp.table
|
||||
table.schema
|
||||
print(table.schema)
|
||||
```
|
||||
|
||||
### Run raw queries¶
|
||||
|
|
@ -213,12 +209,8 @@ One of the preliminary steps in analysing embeddings is by plotting them in 2D s
|
|||

|
||||
|
||||
```python
|
||||
pip install scikit-learn
|
||||
|
||||
%matplotlib inline
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
from sklearn.decomposition import PCA
|
||||
from sklearn.decomposition import PCA # pip install scikit-learn
|
||||
|
||||
# Reduce dimensions using PCA to 3 components for visualization in 3D
|
||||
pca = PCA(n_components=3)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue