update readme
Browse files- README.md +32 -0
- data_readme/sample_100_box_pos.png +0 -0
README.md
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
## Code snippet to visualise the position of the box
|
3 |
+
|
4 |
+
```python
|
5 |
+
import matplotlib.image as img
|
6 |
+
import matplotlib.pyplot as plt
|
7 |
+
from datasets import load_dataset
|
8 |
+
from matplotlib.patches import Rectangle
|
9 |
+
# Load dataset
|
10 |
+
ds_name = "SaulLu/Stanford-Cars"
|
11 |
+
ds = load_dataset(ds_name, use_auth_token=True)
|
12 |
+
# Extract information for the sample we want to show
|
13 |
+
index = 100
|
14 |
+
sample = ds["train"][index]
|
15 |
+
box_coord = sample["bbox"][0]
|
16 |
+
img_path = sample["image"].filename
|
17 |
+
# Create plot
|
18 |
+
# define Matplotlib figure and axis
|
19 |
+
fig, ax = plt.subplots()
|
20 |
+
# plot figure
|
21 |
+
image = img.imread(img_path)
|
22 |
+
ax.imshow(image)
|
23 |
+
# add rectangle to plot
|
24 |
+
ax.add_patch(
|
25 |
+
Rectangle((box_coord[2], box_coord[0]), box_coord[3] - box_coord[2], box_coord[1] - box_coord[0], fill=None)
|
26 |
+
)
|
27 |
+
# display plot
|
28 |
+
plt.show()
|
29 |
+
```
|
30 |
+
|
31 |
+
Result:
|
32 |
+

|
data_readme/sample_100_box_pos.png
ADDED
![]() |