### **登录**
sudo -i password
### **进入目录**
cd /root/AI
### **查看文件夹**
ls -l
### **文件提权**
chmod +x xxx.sh
### **安装**
./xxx.sh
### **或者**
bash xxx.sh
### **添加到环境变量**
**source ~/.bashrc**
### **安装conda包**
cd conda-packages/
conda install --use-local *
### **安装pip包**
cd /root/AI/pip-packages
pip install --no-index --find-links=. *
### **查看python版本**
python --version
### ///**可能会有**
sudo apt-get install -y libsm6
sudo apt-get install -y libxrender1
sudo apt-get install -y libxext-dev
### ///**验证**
**python**
import tensorflow as tf
print(tf.constant('xxx').numpy().decode())
import cv2
import numpy as np
print(cv2.resize(np.zeros((6,6)),(3,3)))
### **jupyter notebook**
ifconfig
jupyter notebook --ip xxx.xxx.xxx.xx --allow-root
### **//导入**
from tensorflow import keras
from tensorflow.keras.applications.vgg16 import VGG16
from tensorflow.keras.callbacks import EarlyStopping,ModelCheckpoint
from tensorflow.keras.layers import Input,Dense
from tensorflow.keras.models import Model
### **//数据集划分**
width=32
height=32
channel=3
train_ratio=0.8 #**0.8<=train_ratio<=0.9**
crop_fix_size=(30,30)
crop_ratio=0.5 #**0.5<=crop_ratio<=0.8**
### **//图片处理**
#### **剪裁**
x=random.randint(0,img.shape[0]-crop_fix_size[0]-1)
y=random.randint(0,img.shape[1]-crop_fix_size[1]-1)
img=img[x:x+crop_fix_size[0],y:y+crop_fix_size[1],:]
#### **缩放**
cv2.resize(img,dsize=size,interpolation=cv2.INTER_AREA)
#### **翻转**
cv2.flip(img1,1,dst=None) #水平
cv2.flip(img1,0,dst=None) #垂直
cv2.flip(img1,-1,dst=None) #镜像(对角)
cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) #灰度