在 TypeScript 中使用 paths + baseUrl 配置时,我在运行 mocha 时遇到问题
我的 tsconfig.js 设置如下:
"baseUrl": "./src/", /* Base directory to resolve non-absolute module names. */
"paths": {
"interfaces/*": [
"interfaces/*"
],
"models/*": [
"models/*"
],
"schemas/*": [
"schemas/*"
],
"classes/*": [
"classes/*"
],
"libs/*": [
"libs/*"
],
"config/*": [
"config/*"
]
Run Code Online (Sandbox Code Playgroud)
我将 mocha 运行为“mocha build/test”
编译后的 TS 代码无法找到我的引用,因为它编译为
var user_1 = require("interfaces/user");
Run Code Online (Sandbox Code Playgroud)
如果我事先添加“../”,它将毫无问题地编译
你知道我在这里做错了什么吗?
我在谷歌计算上运行了一个 nginx-gunicorn-flask 设置,我不断从 gunicorn 获得以下信息:
[2019-04-19 20:50:49 +0000] [3345] [DEBUG] POST /
[2019-04-19 20:50:49 +0000] [3345] [DEBUG] Ignoring EPIPE
Run Code Online (Sandbox Code Playgroud)
在 100 个请求中,大约有 23 个是这样出现的。在访问日志中只显示了 23 个请求,它们都是 200 个。
从 nginx 访问日志显示 504,在错误日志中我看到:
2019/04/19 20:50:49 [error] 3097#3097: *295 upstream timed out (110: Connection timed out) while sending request to upstream, client: ip, server: , request: "POST / HTTP/1.1", upstream: "http://unix:/home/user/Server/server.sock/", host: "ip"
Run Code Online (Sandbox Code Playgroud)
我试过设置
proxy_connect_timeout 75s;
proxy_read_timeout 300s;
Run Code Online (Sandbox Code Playgroud)
--timeout 300根据其他问题在 nginx 和gunicorn上的位置,但没有帮助。
来自 gunicorn 的消息并没有真正帮助确定原因,我没有找到任何相关信息
一直试图解决这个问题,我很感激任何想法。此外,这些请求中的每一个都需要大约 1-2 秒,并且 jmeter …
我一直在尝试清除 OCR 图像:(线条)
我需要删除这些行以有时进一步处理图像并且我已经非常接近但很多时间阈值从文本中带走了太多:
copy = img.copy()
blur = cv2.GaussianBlur(copy, (9,9), 0)
thresh = cv2.adaptiveThreshold(blur,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY_INV,11,30)
kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (9,9))
dilate = cv2.dilate(thresh, kernel, iterations=2)
cnts = cv2.findContours(dilate, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
cnts = cnts[0] if len(cnts) == 2 else cnts[1]
for c in cnts:
area = cv2.contourArea(c)
if area > 300:
x,y,w,h = cv2.boundingRect(c)
cv2.rectangle(copy, (x, y), (x + w, y + h), (36,255,12), 3)
Run Code Online (Sandbox Code Playgroud)
编辑:此外,如果字体发生变化,使用常量数字将不起作用。有没有通用的方法来做到这一点?
我使用 Debian 安装在我的 VM 上安装了 TensorRT。如果我运行“dpkg -l | grep TensorRT”,我会得到预期的结果:
ii graphsurgeon-tf 5.0.2-1+cuda10.0 amd64 GraphSurgeon for TensorRT package
ii libnvinfer-dev 5.0.2-1+cuda10.0 amd64 TensorRT development libraries and headers
ii libnvinfer-samples 5.0.2-1+cuda10.0 all TensorRT samples and documentation
ii libnvinfer5 5.0.2-1+cuda10.0 amd64 TensorRT runtime libraries
ii python3-libnvinfer 5.0.2-1+cuda10.0 amd64 Python 3 bindings for TensorRT
ii python3-libnvinfer-dev 5.0.2-1+cuda10.0 amd64 Python 3 development package for TensorRT
ii tensorrt 5.0.2.6-1+cuda10.0 amd64 Meta package of TensorRT
ii uff-converter-tf 5.0.2-1+cuda10.0 amd64 UFF converter for TensorRT package
Run Code Online (Sandbox Code Playgroud)
然而,当我尝试在 python …
当 div 具有flex显示属性时,它会拉伸段落。我似乎遗漏了一些东西,但我认为放在 Flex div 上的任何属性都不会改变这一点。我怎样才能防止这种行为?(没有 flex 属性,我得到图像右侧的结果)
div {
display: flex;
justify-content: center;
flex-direction: column;
height: 200px;
width: 100px;
}
p {
background-color: green;
display: inline;
}Run Code Online (Sandbox Code Playgroud)
<div>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
</p>
</div>Run Code Online (Sandbox Code Playgroud)
我正在尝试以 json 格式发送 OpenCV 图像并在另一端接收它,但在编码和解码图像时遇到了无穷无尽的问题
我通过以下方式以 JSON 形式发送它:
dumps({"image": b64encode(image[y1:y2, x1:x2]).decode('utf-8')})
Run Code Online (Sandbox Code Playgroud)
在另一端,我尝试解码它(我需要它作为枕头图像):
image = Image.open(BytesIO(base64.b64decode(data['image'])))
Run Code Online (Sandbox Code Playgroud)
但我越来越Exception cannot identify image file <_io.BytesIO object at 0x7fbd34c98a98>
还尝试过:
nparr = np.fromstring(b64decode(data['image']), np.uint8)
image = cv2.imdecode(nparr, cv2.COLOR_BGR2RGB)
pil_image = Image.fromarray(image)
Run Code Online (Sandbox Code Playgroud)
但后来我'NoneType' object has no attribute '__array_interface__'来自Image.fromarray
有什么想法我做错了吗?
我正在使用基于 tenserflow 的 Mask RCNN 库,但我似乎无法让它在我的 GPU (1080TI) 上运行。推理时间为 4-5 秒,在此期间我看到我的 cpu 出现使用高峰,但我的 gpu 没有。对此有任何可能的修复吗?
python ×4
opencv ×2
base64 ×1
compilation ×1
css ×1
flexbox ×1
gunicorn ×1
html ×1
json ×1
keras ×1
linux ×1
mocha.js ×1
nginx ×1
ocr ×1
path ×1
python-3.x ×1
server ×1
tensorflow ×1
tensorrt ×1
testing ×1
typescript ×1
ubuntu-18.04 ×1