Update README.md
Browse files
README.md
CHANGED
@@ -68,10 +68,8 @@ def run_example(task_prompt, image, max_new_tokens=128):
|
|
68 |
def plot_bbox(image, data):
|
69 |
# Create a figure and axes
|
70 |
fig, ax = plt.subplots()
|
71 |
-
|
72 |
# Display the image
|
73 |
ax.imshow(image)
|
74 |
-
|
75 |
# Plot each bounding box
|
76 |
for bbox, label in zip(data['bboxes'], data['labels']):
|
77 |
# Unpack the bounding box coordinates
|
@@ -82,10 +80,8 @@ def plot_bbox(image, data):
|
|
82 |
ax.add_patch(rect)
|
83 |
# Annotate the label
|
84 |
plt.text(x1, y1, label, color='white', fontsize=8, bbox=dict(facecolor='red', alpha=0.5))
|
85 |
-
|
86 |
# Remove the axis ticks and labels
|
87 |
ax.axis('off')
|
88 |
-
|
89 |
# Show the plot
|
90 |
plt.show()
|
91 |
|
@@ -98,7 +94,6 @@ example_id = 5
|
|
98 |
image = dataset["train"][example_id]["image"]
|
99 |
|
100 |
parsed_answer = run_example("<OD>", image=image)
|
101 |
-
|
102 |
plot_bbox(image, parsed_answer["<OD>"])
|
103 |
```
|
104 |
|
|
|
68 |
def plot_bbox(image, data):
|
69 |
# Create a figure and axes
|
70 |
fig, ax = plt.subplots()
|
|
|
71 |
# Display the image
|
72 |
ax.imshow(image)
|
|
|
73 |
# Plot each bounding box
|
74 |
for bbox, label in zip(data['bboxes'], data['labels']):
|
75 |
# Unpack the bounding box coordinates
|
|
|
80 |
ax.add_patch(rect)
|
81 |
# Annotate the label
|
82 |
plt.text(x1, y1, label, color='white', fontsize=8, bbox=dict(facecolor='red', alpha=0.5))
|
|
|
83 |
# Remove the axis ticks and labels
|
84 |
ax.axis('off')
|
|
|
85 |
# Show the plot
|
86 |
plt.show()
|
87 |
|
|
|
94 |
image = dataset["train"][example_id]["image"]
|
95 |
|
96 |
parsed_answer = run_example("<OD>", image=image)
|
|
|
97 |
plot_bbox(image, parsed_answer["<OD>"])
|
98 |
```
|
99 |
|