(更新了代码以使用新的Explorer类,并创建了嵌入表和相似图像数据框)
This commit is contained in:
parent
1096059bf3
commit
e853c360b1
18
1.py
18
1.py
@ -1,11 +1,17 @@
|
|||||||
from ultralytics import YOLO
|
from ultralytics import YOLO,Explorer
|
||||||
|
|
||||||
# Load a pre-trained YOLOv10n model
|
# Load a pre-trained YOLOv10n model
|
||||||
model = YOLO("./yolov10x.pt")
|
# model = YOLO("./yolov10x.pt")
|
||||||
model.train(data="./dataset.yaml", epochs=3)
|
explorer = Explorer(data="./dataset.yaml", model="yolov10x.pt")
|
||||||
|
explorer.create_embeddings_table()
|
||||||
|
similar_images_df = explorer.get_similar(img="./1.jpg")
|
||||||
|
a=explorer.sql_query("WHERE labels LIKE '%person%' AND labels LIKE '%cake%' LIMIT 10")
|
||||||
|
print(a)
|
||||||
|
# model.train(data="./dataset.yaml", epochs=3)
|
||||||
|
|
||||||
# Perform object detection on an image
|
# Perform object detection on an image
|
||||||
results = model("./1.jpg")
|
# results = model("./1.jpg")
|
||||||
|
# print(results)
|
||||||
# Display the results
|
# Display the results
|
||||||
results[0].show()
|
# results[0].show()
|
||||||
|
# results[0].save(filename="result.jpg") # save to disk 保存到磁盘
|
||||||
|
BIN
result.jpg
Normal file
BIN
result.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 194 KiB |
Loading…
x
Reference in New Issue
Block a user