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
|
```bash
|
||||||
%pip install ultralytics[explorer] openai
|
%pip install ultralytics[explorer] openai
|
||||||
import ultralytics
|
yolo checks
|
||||||
|
|
||||||
ultralytics.checks()
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Similarity Search
|
## Similarity Search
|
||||||
|
|
@ -88,11 +86,9 @@ You can use the also plot the similar samples directly using the `plot_similar`
|
||||||
|
|
||||||
```python
|
```python
|
||||||
exp.plot_similar(idx=6500, limit=20)
|
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(
|
exp.plot_similar(img="https://ultralytics.com/images/bus.jpg", limit=10, labels=False) # Can also pass external images
|
||||||
img="https://ultralytics.com/images/bus.jpg", limit=10, labels=False
|
|
||||||
) # Can also pass any external images
|
|
||||||
```
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|
@ -149,7 +145,7 @@ exp.plot_sql_query("WHERE labels LIKE '%person, person%' AND labels LIKE '%dog%'
|
||||||
|
|
||||||
```python
|
```python
|
||||||
table = exp.sql_query("WHERE labels LIKE '%person, person%' AND labels LIKE '%dog%' LIMIT 10")
|
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`
|
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
|
```python
|
||||||
table = exp.table
|
table = exp.table
|
||||||
table.schema
|
print(table.schema)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Run raw queries¶
|
### Run raw queries¶
|
||||||
|
|
@ -213,12 +209,8 @@ One of the preliminary steps in analysing embeddings is by plotting them in 2D s
|
||||||

|

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