中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁 > news >正文

花生殼域名可以做網(wǎng)站域名嗎3322免費(fèi)域名注冊(cè)

花生殼域名可以做網(wǎng)站域名嗎,3322免費(fèi)域名注冊(cè),做農(nóng)產(chǎn)品的網(wǎng)站名稱,某公司網(wǎng)頁設(shè)計(jì)通過PaddleOCR識(shí)別圖片中的文字,將識(shí)別結(jié)果報(bào)存到es中,利用es查詢語句返回結(jié)果圖片。 技術(shù)邏輯 PaddleOCR部署、es部署創(chuàng)建mapping將PaddleOCR識(shí)別結(jié)果保存至es通過查詢,返回結(jié)果 前期準(zhǔn)備 PaddleOCR、es部署請(qǐng)參考https://blog.csdn.net…

通過PaddleOCR識(shí)別圖片中的文字,將識(shí)別結(jié)果報(bào)存到es中,利用es查詢語句返回結(jié)果圖片。

技術(shù)邏輯

  • PaddleOCR部署、es部署
  • 創(chuàng)建mapping
  • 將PaddleOCR識(shí)別結(jié)果保存至es
  • 通過查詢,返回結(jié)果

前期準(zhǔn)備

PaddleOCR、es部署請(qǐng)參考https://blog.csdn.net/zhanghan11366/article/details/137026144?spm=1001.2014.3001.5502

創(chuàng)建mapping

from elasticsearch import Elasticsearch# 連接Elasticsearch
es_client = Elasticsearch("http://0.0.0.0:9200/", basic_auth=("elastic", "ZargEZ7NmJRkXLFlEqgE"))# 創(chuàng)建新的ES index
mapping = {'properties': {'description': {'type': 'text','analyzer': 'ik_smart','search_analyzer': 'ik_smart'},"insert_time": {"type": "date","format": "yyyy-MM-dd HH:mm:ss"},"image_path":{'type': 'text'}}
}es_client.indices.create(index='wechat_search_ocr', ignore=400)
result = es_client.indices.put_mapping(index='wechat_search_ocr', body=mapping)
print(result)

將PaddleOCR識(shí)別結(jié)果保存至es

核心代碼展示

def image_ocr(image_dir):files = os.listdir(image_dir)image_files = [file for file in files if file.endswith(('jpg', 'jpeg', 'png', 'gif'))]for image_file in image_files:image_path = os.path.join(image_dir, image_file)if not os.path.isfile(image_path):print(f"文件不存在:{image_path}")continueimage = cv2.imread(image_path)if image is None:print(f"無法讀取圖像:{image_path}")continueimage_base64 = cv2_to_base64(image)data = {'images': [image_base64]}headers = {"Content-type": "application/json"}url = "http://192.168.30.71:8866/predict/ch_pp-ocrv3"try:r = requests.post(url=url, headers=headers, data=json.dumps(data))r.raise_for_status()  # 檢查請(qǐng)求是否成功ocr_results = r.json().get("results", [])if ocr_results:description = "\n".join([ocr_record["text"].strip() for ocr_record in ocr_results[0]["data"]])doc = {"description": description,"insert_time": dt.now().strftime("%Y-%m-%d %H:%M:%S"),"image_path": image_file}es_client.index(index="wechat_search_ocr", body=doc)print("成功插入到 Elasticsearch 中!")else:print("OCR 服務(wù)返回結(jié)果為空!")except Exception as e:print(f"處理圖像 {image_path} 時(shí)發(fā)生錯(cuò)誤:{str(e)}")

通過查詢,返回結(jié)果

核心代碼展示

def image_search_by_text(query_str):result = []# 對(duì)query進(jìn)行全文搜索queries = query_str.split()dsl = {"query": {"bool": {"must": [{"match": {"description": _}} for _ in queries]}},"size": 5}search_result = es_client.search(index='wechat_search_ocr', body=dsl)return search_resultdef image_search_interface(query_str):# 查詢圖像search_results = image_search_by_text(query_str)# 構(gòu)建結(jié)果images=[]for hit in search_results['hits']['hits']:image_filename = hit['_source']['image_path']image_path = os.path.join('./data', image_filename)image = Image.open(image_path).convert('RGB')images.append(image)if len(images) >= 3:images = images[:3]else:for _ in range(3 - len(images)):images.append(None)return images[0], images[1], images[2]

結(jié)果如下:
在這里插入圖片描述

http://www.risenshineclean.com/news/22205.html

相關(guān)文章:

  • 平面設(shè)計(jì)素材網(wǎng)站排名武漢搜索排名提升
  • 購物網(wǎng)站開發(fā)實(shí)例網(wǎng)絡(luò)服務(wù)提供商
  • wordpress多國語言設(shè)置淘寶seo是什么意思
  • 網(wǎng)站制作 臺(tái)州淘寶代運(yùn)營1個(gè)月多少錢
  • 一個(gè)做搞笑類視頻的網(wǎng)站取名seo學(xué)習(xí)網(wǎng)站
  • 北京it行業(yè)公司排名關(guān)于華大18年專注seo服務(wù)網(wǎng)站制作應(yīng)用開發(fā)
  • 怎么用一個(gè)主機(jī)做多個(gè)網(wǎng)站軟文之家
  • 網(wǎng)站建設(shè)合同英文版seo 優(yōu)化技術(shù)難度大嗎
  • 眉山網(wǎng)站制作最吸引人的引流話術(shù)
  • 推廣公司如何賺錢網(wǎng)站優(yōu)化策劃書
  • 做界面的網(wǎng)站12月30日疫情最新消息
  • 南平公司做網(wǎng)站pc網(wǎng)站建設(shè)和推廣
  • 文案交流網(wǎng)站免費(fèi)網(wǎng)站大全下載
  • 2015做哪些網(wǎng)站致富什么是互聯(lián)網(wǎng)營銷
  • 有阿里空間怎么做網(wǎng)站百度推廣后臺(tái)登錄頁面
  • 網(wǎng)站廣告位價(jià)格一般多少定制化網(wǎng)站建設(shè)
  • 自己做的網(wǎng)站可以掛在哪里自己怎么做網(wǎng)頁推廣
  • 網(wǎng)站關(guān)鍵詞詞庫app拉新推廣
  • 怎么做網(wǎng)站首頁psd整站優(yōu)化服務(wù)
  • 全球最受歡迎的網(wǎng)站排名今日熱點(diǎn)新聞
  • 哪個(gè)網(wǎng)站可以做思維導(dǎo)圖鳳山網(wǎng)站seo
  • 做美圖 網(wǎng)站有哪些東西沈陽優(yōu)化網(wǎng)站公司
  • 蒙城做網(wǎng)站的公司百度手機(jī)助手下載正版
  • 響應(yīng)式網(wǎng)站建設(shè)資訊培訓(xùn)行業(yè)seo整站優(yōu)化
  • 能打開各種網(wǎng)站的瀏覽器推薦企業(yè)培訓(xùn)計(jì)劃
  • 天津做網(wǎng)站要多少錢廣州網(wǎng)站優(yōu)化關(guān)鍵詞排名
  • 做特價(jià)的網(wǎng)站網(wǎng)絡(luò)推廣運(yùn)營優(yōu)化
  • 做相冊(cè)哪個(gè)網(wǎng)站好用長沙本地推廣
  • 凡客優(yōu)品家居官方網(wǎng)站網(wǎng)站模板設(shè)計(jì)
  • 南昌做公司網(wǎng)站哪家好優(yōu)化是什么意思