小编Har*_*mar的帖子

在第一次会话中,tmux 说“没有当前会话”

每当我第一次打开 tmux 时,它都会抛出以下错误。

/home/user/.tmux.conf:67: no current window
Run Code Online (Sandbox Code Playgroud)

conf文件的相关部分如下。

 52 set-window-option -g window-status-fg "#666666"
 53 set-window-option -g window-status-bg default
 54 set-window-option -g window-status-attr default
 55 set-window-option -g window-status-current-fg red
 56 set-window-option -g window-status-current-bg default
 57 set-window-option -g window-status-current-attr default
 58 set-option -g message-fg white
 59 set-option -g message-bg black
 60 set-option -g message-attr bright
 61 set -g status-left " "
 62 set -g status-justify left
 63 setw -g window-status-format         ' #(echo "[#{window_index}]#{window_name}") '
 64 #setw -g window-status-current-format         ' #(echo "[#{window_index}]#{window_name}") ' …
Run Code Online (Sandbox Code Playgroud)

tmux

11
推荐指数
1
解决办法
2774
查看次数

Seaborn热图不显示所有xticks和yticks

我有一个形状的熊猫数据帧(39,67).当我绘制seaborn热图时,我没有在X和Y轴上获得那么多标签..get_xticklabels()方法也只返回23个标签.

数据帧的Seaborn热图

matplotlib 不显示任何标签(仅限数字).

Matpllotlib热图

这两个热图都是针对相同的数据帧(39,67).

python matplotlib pandas seaborn

8
推荐指数
2
解决办法
6329
查看次数

如何通过删除张量来释放 GPU 内存?

假设我创建了一个张量并将其放在 GPU 上并且以后不需要它并且想要释放分配给它的 GPU 内存;我该怎么做?

import torch
a=torch.randn(3,4).cuda() # nvidia-smi shows that some mem has been allocated.
# do something
# a does not exist and nvidia-smi shows that mem has been freed.
Run Code Online (Sandbox Code Playgroud)

我试过了:

  1. del a
  2. del a; torch.cuda.empty_cache()

但它们都不起作用。

python pytorch

6
推荐指数
1
解决办法
6073
查看次数

如果使用黑白图像,OpenCV findContours()会抱怨

我想用以下代码执行边缘检测.但是由于图像颜色深度,我得到一个错误.这个错误在我的眼中没有任何意义,因为我将图像正确地转换为灰度图像,并在随后的步骤中转换为黑白图像,这肯定是正确的.当我调用findContours时,我收到一个错误.

import cv2

def bw_scale(file_name, tresh_min, tresh_max):
    image = cv2.imread(file_name)
    image = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
    #(thresh, im_bw) = cv2.threshold(image, tresh_min, tresh_max, cv2.THRESH_BINARY | cv2.THRESH_OTSU)
    (thresh, im_bw) = cv2.threshold(image, tresh_min, tresh_max, 0)

    cv2.imwrite('bw_'+file_name, im_bw)
    return (thresh, im_bw)

def edge_detect(file_name, tresh_min, tresh_max):
    (thresh, im_bw) = bw_scale(file_name, tresh_min, tresh_max)
    contours, hierarchy = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)


if __name__ == '__main__':
  edge_detect('test.jpg', 128, 255)
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

dgrat@linux-v3pk:~> python aoi.py
OpenCV Error: Unsupported format or combination of formats ([Start]FindContours support only 8uC1 and 32sC1 images) in cvStartFindContours, file …
Run Code Online (Sandbox Code Playgroud)

python opencv

4
推荐指数
2
解决办法
3万
查看次数

标签 统计

python ×3

matplotlib ×1

opencv ×1

pandas ×1

pytorch ×1

seaborn ×1

tmux ×1