原创 pytorch神經網絡工作站搭建

第一步 conda create -n torch source activate torch conda install -c anaconda pytorch-gpu 第二步 source activate torch

原创 conda install 等價與pip install -e .

這兩種命令都會自動查找和下載依賴包,並會自動對應版本號。 常規安裝命令:python setup.py

原创 python跳出雙循環break

用for else語句。 import matplotlib.pyplot as plt fig, ax = plt.subplots() for i in range(10): for j in range(10):

原创 k-means clustering原理與舉例

圖像聚類一般是灰度值的聚類。 import numpy as np import cv2 img = cv2.imread('differential geometry.jpeg') img2 = img.reshape((-1,3)

原创 淋巴結病理數字玻片讀取與處理代碼

Whole-slide images are generally stored in a multi-resolution pyramid structure. 首先安裝openslide模塊 pip install opensl

原创 linux增加10T硬盤

su root fdisk -l   如果你是IDE 接 口 硬 盤 :/dev/dh[a-z],這裏的硬盤名字應該是dh[a-z]開頭   如果你是SCSI 接 口 硬 盤 : / dev/[ a -z ],這裏的硬盤名字應該是sd

原创 linux系統的txt亂碼解決方案

iconv -f gb18030  -t utf8 1.txt -o 2.txt windows系統下,默認編碼格式是gb18030,linux默認編碼格式是utf-8格式

原创 循環神經網絡的關鍵庫函數(tensorflow)

tf.nn.rnn_cell.BasicLSTMCell __init__( num_units, forget_bias=1.0, state_is_tuple=True, activation=Non

原创 python輸出txt函數的兩種模式

file = open("write_test.txt", encoding="utf-8",mode="w") file.write("君臣佐使") file.close() with open("write

原创 tensorflow的Data API

  例1 import tensorflow as tf import numpy as np BATCH_SIZE = 2 train_x = np.array([1.0, 2.0, 3.0, 4.0, 5.0]) train_

原创 關於python 條件語句if的遍歷性

for i in range(10): if i == 1: print('p') elif i == 2: print('y') elif i

原创 python圖像convert()

convert() convert()是圖像實例對象的一個方法,接受一個 mode 參數,用以指定一種色彩模式1 ------------------(1位像素,黑白,每字節一個像素存儲)L ------------------(8位像素

原创 tf.tile()其實就是貼瓷磚

tf.tile(     input,     multiples,     name=None ) Args: input: A Tensor. 1-D or higher. multiples: A Tensor. Must be

原创 python圖像處理opencv包大型指導

二值化 cv2.threshold import cv2 import numpy as np img = cv2.imread('Hydrogen_Density_Plots.png',0) threshold = 10 maxval

原创 python圖像大小縮放

import cv2 tile = cv2.resize(tile,(int(Ximageorg/256),int(Yimageorg/256)),interpolation=cv2.INTER_CUBIC)