Skip to content

Commit

Permalink
解决使用gpu的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
alisen39 committed Jul 30, 2020
1 parent 4fb9a7f commit 1000efd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
15 changes: 8 additions & 7 deletions backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,19 @@
# time: 2020/4/28 14:54
import os
import sys

BASE_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_PATH)

from tornado.options import define, options
import tornado.web
import tornado.httpserver
import tornado.ioloop
import logging
from tornado.web import StaticFileHandler

BASE_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_PATH)
from backend.tools.get_host_ip import host_ip
from backend.tools import manage_running_platform
from backend.webInterface import tr_run
from backend.webInterface import tr_index
from backend.tools import log
import logging


logger = logging.getLogger(log.LOGGER_ROOT_NAME + '.' + __name__)

Expand All @@ -30,6 +28,9 @@


def make_app():
from backend.webInterface import tr_run
from backend.webInterface import tr_index

return tornado.web.Application([
(r"/api/tr-run/", tr_run.TrRun),
(r"/", tr_index.Index),
Expand Down
1 change: 1 addition & 0 deletions backend/tools/version_map.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"c08afbf0f98626d4dbf7a5cf616c9582558edf602477c3374bde8377e3f1b30c13510942f91169ca7e379aef7fcf3f2b2754f685375645c5eb8e158cc1023cf2": "gpu", "14c25201ca9ccbc8e9a8a565beaf676fc3da2faa93d7ed2e75f6c7dc947a180cd6aa89fbaf83076fa973805a218ac4838a2daf849f2cc9abd679cbee0db83350": "cpu"}
Empty file modified backend/tr/tr.py
100644 → 100755
Empty file.
5 changes: 3 additions & 2 deletions backend/webInterface/tr_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import time
import cv2
import numpy as np
import tr
from backend.tr import tr
import tornado.web
import tornado.gen
import tornado.httpserver
Expand Down Expand Up @@ -129,7 +129,8 @@ def post(self):
box = np.int0(np.round(box))

for p1, p2 in [(0, 1), (1, 2), (2, 3), (3, 0)]:
img_draw.line(xy=(box[p1][0], box[p1][1], box[p2][0], box[p2][1]), fill=colors[i % len(colors)], width=2)
img_draw.line(xy=(box[p1][0], box[p1][1], box[p2][0], box[p2][1]), fill=colors[i % len(colors)],
width=2)

output_buffer = BytesIO()
img_detected.save(output_buffer, format='JPEG')
Expand Down

0 comments on commit 1000efd

Please sign in to comment.