人妖在线一区,国产日韩欧美一区二区综合在线,国产啪精品视频网站免费,欧美内射深插日本少妇

新聞動(dòng)態(tài)

Python Flask搭建yolov3目標(biāo)檢測(cè)系統(tǒng)詳解流程

發(fā)布日期:2021-12-13 18:05 | 文章來源:源碼中國(guó)

【人工智能項(xiàng)目】Python Flask搭建yolov3目標(biāo)檢測(cè)系統(tǒng)

后端代碼

from flask import Flask, request, jsonify
from PIL import Image
import numpy as np
import base64
import io
import os
from backend.tf_inference import load_model, inference
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
sess, detection_graph = load_model()
app = Flask(__name__)
@app.route('/api/', methods=["POST"])
def main_interface():
 response = request.get_json()
 data_str = response['image']
 point = data_str.find(',')
 base64_str = data_str[point:]  # remove unused part like this: "data:image/jpeg;base64,"
 image = base64.b64decode(base64_str) 
 img = Image.open(io.BytesIO(image))
 if(img.mode!='RGB'):
  img = img.convert("RGB")
 
 # convert to numpy array.
 img_arr = np.array(img)
 # do object detection in inference function.
 results = inference(sess, detection_graph, img_arr, conf_thresh=0.7)
 print(results)
 return jsonify(results)
@app.after_request
def add_headers(response):
 response.headers.add('Access-Control-Allow-Origin', '*')
 response.headers.add('Access-Control-Allow-Headers', 'Content-Type,Authorization')
 return response

if __name__ == '__main__':
 app.run(debug=True, host='0.0.0.0')

展示部分

python -m http.server

python app.py

前端展示部分

到此這篇關(guān)于Python Flask搭建yolov3目標(biāo)檢測(cè)系統(tǒng)詳解流程的文章就介紹到這了,更多相關(guān)Python 目標(biāo)檢測(cè)系統(tǒng)內(nèi)容請(qǐng)搜索本站以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持本站!

版權(quán)聲明:本站文章來源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請(qǐng)保持原文完整并注明來源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學(xué)習(xí)參考,不代表本站立場(chǎng),如有內(nèi)容涉嫌侵權(quán),請(qǐng)聯(lián)系alex-e#qq.com處理。

相關(guān)文章

實(shí)時(shí)開通

自選配置、實(shí)時(shí)開通

免備案

全球線路精選!

全天候客戶服務(wù)

7x24全年不間斷在線

專屬顧問服務(wù)

1對(duì)1客戶咨詢顧問

在線
客服

在線客服:7*24小時(shí)在線

客服
熱線

400-630-3752
7*24小時(shí)客服服務(wù)熱線

關(guān)注
微信

關(guān)注官方微信
頂部