原创 c++ 路徑無需轉義字符

這樣就不用轉義字符了,重點就是大寫字母 R 以及 括號 root_dir = R"(E:\data\aa\aaa\aaa\)"

原创 pytorch debugging PyCharm/Pycharm調試 pytorch 查看變量 顯示 timimg out

問題 pycharm 調試的時候,變量顯示 timing out 解決方案 把 num_workers 設置爲0 reference :https://stackoverflow.com/questions/59030675

原创 宿主機 ssh登錄docker容器 出現錯誤

錯誤、問題 配置好docker容器以後,在宿主機裏面ssh登錄到容器內部,出現以下問題: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNI

原创 python 自動獲取可用GPU的ID

from gpuinfo import GPUInfo def get_gpu_id(num_gpu=1): """get ID of GPUS :param num_gpu: num of GPUs to u

原创 linux 安裝Anaconda/Miniconda以後無法識別conda命令

修改環境變量 vim ~/.bashrc 在最後添加: export PATH=~/miniconda2/bin:$PATH 注意具體的路徑需要根據實際情況添加 重啓環境變量: source ~/.bashrc

原创 linxu/torch/pytorch會自動安裝 cuda

如下圖所示

原创 python/matplotlib繪製統計直方圖

記錄一下繪製統計直方圖的代碼 for k, v in area_dict.items(): plt.figure() plt.hist(v, bins=40, density=0, facecolor="blue

原创 python / matploylib 繪製水平柱狀圖

記錄一下matplotlib繪製水平 柱狀圖的代碼 import matplotlib.pyplot as plt # 構建數據 plt.figure(figsize=(12, 8)) x_data = keys_set y_da

原创 linux screen修改session的名字

之前都是毀掉session,然後重新創建。後來覺得還是能夠直接修改比較方便。但找到方法以後發現其實也沒有 那麼方便。因爲需要進入被改名字的session之中,然後才能修改名字,具體見下面的鏈接,還是挺清楚的 https://sup

原创 caffe/ windows 10 /Can't parse message of type "caffe.NetParameter" because it is missing required

背景 將linux下訓練的caffemodel移植到windows上使用但是出現以下錯誤提示:Can't parse message of type "caffe.NetParameter" because it is missi

原创 python 讀寫csv有空行

問題 讀出來的CSV文件有空的列表 原因 寫入csv文件時有問題 有問題的寫入代碼: with open('sd.csv', 'w+', ') as f: a = csv.writer(f) a.writerows

原创 c++智能指針 std::unique_ptr的get()

// unique_ptr::get vs unique_ptr::release #include <iostream> #include <memory> int main () {

原创 python-格式化寫入xml文件

背景 直接寫入xml文件,最終得到的xml文件時一行,不是向我們日常看見的換行以及縮進。 爲了得到得到上面的效果,需要轉換一下,代碼如下 import xml.etree.ElementTree as ET from xml.d

原创 leetcode-655-輸出二叉樹

# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x #