Leveraging a database of objects detected with Standard Query Operators to build rich drone video sensing applications.
We mentioned the drone video sensing platform DFCS to comprise of a vision processor, an analytical engine and a drone router where the vision processor creates vectors for keypoints that are a tuple of pixel position and feature descriptor of the patch around the pixel which translates to world co-ordinates and time lapse information of that location. While many of the questions can directly be answered with a search on this vector database or with multimodal search directly on the selected frames, we also leverage RAG by creating a database of detected objects which comes in very useful to search with the public reviews of those objects such as say parking spaces from the internet. The aim of the product database as a regular structured data source of all detected objects is that we can now leverage standard query operators to build rich uav swarm sensing applications.
For example,
-- My Position
declare @myposition geography = geography::STGeomFromText('POINT(-0.2173896258649289, 51.484376146936256)' 4326)
-- Get Embeddings from OpenAI
declare @e varbinary(8000);
exec dbo.get_embeddings
@model = 'text-embedding-3-small'
@text = 'a place to park a car on Thursday 1-3 pm GMT',
@embedding = @e output;
with cte as
(
select
e.review_id,
vector_distance('cosine', embedding, @e) as distance
from
dbo.review_embeddings e
)
select top(10)
b.id as business_id,
b.name,
r.id as review_id,
r.stars,
@myposition.STDistance(geo_location) as geo_distance,
1-e.distance as similarity
from
cte e
inner join
dbo.reviews r on e.review_id = r.id
inner join
dbo.business b on r.business_id = b.id
where
b.city = 'London'
and
@myposition.STDistance(geo_location) < 5000 -- 5 km
and
regexp_like(cast(b.categories as varchar(1000)), 'Parking|Street')
and
r.stars >= 4
and
b.reviews > 30
and
json_value(b.custom_attributes, '$."metered"') = 'yes'
order by
distance
go
The above direct SQL query on the database combined with built-in vector search allows a traditional web application to be created or the application can query a chatbot with a system message as “You are an AI assistant that helps people find parking. Give as many details as possible about each parking space such as price. Whenever you respond, please format your answer to make it readable including bullet points.” to define the AI's personality, tone and capabilities and leverage the detected objects database for Retrieval Augmented Generation.
No comments:
Post a Comment