2025-05-27 15:46:31 +08:00

63 lines
1.9 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from thermal_process import ThermalProcessor
from thermal_vision import ThermalVision
processor = ThermalProcessor()
vision = ThermalVision()
# 处理CSV文件
csv_path = "thermal_data_20250319_004854.csv" # 替换为你的CSV文件
heatmap_main, metadata_main = processor.process_csv(csv_path)
# 显示元数据
print("文件元数据:")
for key, value in metadata_main.items():
print(f" {key}: {value}")
# 保存热图
output_path = "output_heatmap.png"
processor.save_image(heatmap_main, output_path)
print(f"热图已保存为: {output_path}")
# 处理CSV文件
heatmap_1, metadata = processor.process_csv(csv_path,min_temp=metadata_main["min_temp"]+1,max_temp=metadata_main["max_temp"]+1)
# 保存热图
output_path = "output_heatmap_1.png"
processor.save_image(heatmap_1, output_path)
print(f"热图已保存为: {output_path}")
# 处理CSV文件
heatmap_2, metadata = processor.process_csv(csv_path,min_temp=metadata_main["min_temp"]+2,max_temp=metadata_main["max_temp"]+2)
# 保存热图
output_path = "output_heatmap_2.png"
processor.save_image(heatmap_2, output_path)
print(f"热图已保存为: {output_path}")
file_path = "vlm_prompt.txt"
with open(file_path, 'r', encoding='utf-8') as f:
vlm_prompt = f.read()
# 使用系统提示的分析
result = vision.analyze(
image=heatmap_main,
extra_images=[heatmap_1,heatmap_2],
prompt="这是一张背部图片,请你进行分析描述",
system_prompt=vlm_prompt,
stream=False
)
print(result)
file_path = "summarize_prompt.txt"
with open(file_path, 'r', encoding='utf-8') as f:
summarize_prompt = f.read()
result = vision.summarize(
prompt=f"VLM结果如下{result},请你进行分析并且按照格式输出",
system_prompt=summarize_prompt,
stream=True
)
for chunk in result:
chunk_message = chunk.choices[0].delta.content
if chunk_message:
print(chunk_message, end='', flush=True)