咕噜猫小站

do it, do it right, do it right now

0%

Debian 10 UEFI 相关

bios 未识别出 uefi 分区

最近在新磁盘上安装 debian 10 时,出现过安装完成后,bios 未识别出 uefi 分区,从而系统不能正常启动的问题。

根据官网( https://wiki.debian.org/UEFI )介绍,正确的 uefi 启动文件的命名路径为:

iptables

下面列出一段比较通用的服务器 iptable 设置

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# 允许回环地址
iptables -A INPUT -i lo -j ACCEPT
# 允许已建立的连接
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
# 允许自定义的端口进行 TCP 通讯,按需要增减
iptables -A INPUT -p tcp -m multiport --dports 22,443,8388:8400 -j ACCEPT
# 允许自定义的端口进行 UDP 通讯,按需要增减
# iptables -A INPUT -p udp -m multiport --dports 53 -j ACCEPT
# 允许 ping 包
iptables -A INPUT -p icmp -j ACCEPT
# 其余都禁止
iptables -A INPUT -j DROP

附一份比较通俗易懂的 iptables 介绍文档。 ( http://www.zsythink.net/archives/tag/iptables/ )

恢复 windows server 和 win10 ltsb 的图片查看功能

(参考连接: https://jingyan.baidu.com/article/14bd256e40e472bb6c26125b.html )

以管理员身份运行命令提示符(cmd.exe)

在命令提示符输入以下命令并运行即可:

1
2
3
4
5
FTYPE Paint.Picture=%SystemRoot%\System32\rundll32.exe "%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll", ImageView_Fullscreen %1

FTYPE jpegfile=%SystemRoot%\System32\rundll32.exe "%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll", ImageView_Fullscreen %1

FTYPE pngfile=%SystemRoot%\System32\rundll32.exe "%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll", ImageView_Fullscreen %1

virtualenvwrapper 安装配置说明

virtualenvwrapper 是对 python 虚拟环境的使用进行了简单的封装,更方便用户使用虚拟环境。

1. 安装与配置

1.1 Linux

安装

1
sudo pip3 install virtualenvwrapper

编译 /etc/bash.bashrc 文件,增加以下语句

1
2
3
4
5
if [ -f /usr/local/bin/virtualenvwrapper.sh ]; then
  export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
  export WORKON_HOME='~/.virtualenvs'
  source /usr/local/bin/virtualenvwrapper.sh
fi

1.2 Windows

安装

Python 设置 PYPI 私服说明

私服设置

Linux 下编辑文件 /etc/pip.conf 或者 ~/.pip/pip.conf , Windows 下编辑文件 C:\ProgramData\pip\pip.ini 或者 %USERPROFILE%\pip\pip.ini 或者 %APPDATA%\pip\pip.ini添加 extra-index-url 修改 index-url

私服在找不到包时,会替我们到外面找包,因此只需要一个 index-url 即可

slim库中的预处理方法分析


research/slim/preprocessing/cifarnet_preprocessing.py 源码

对图片的预处理过程为:

训练数据集:

  1. 对图片进行填充。(tf.pad)
  2. 按指定大小随机裁剪图像。(tf.random_crop)
  3. 随机水平翻转。(tf.image.random_flip_left_right)
  4. 随机亮度。(tf.image.random_brightness)
  5. 随机对比度。 (tf.image.random_contrast)
  6. 图像标准化。 (tf.image.per_image_standardization)

验证数据集:

05 - Tensorflow 模型保存与恢复

本文大部分是对官网的描述做些备注和个人理解。如有需要,请直接查看官网原文。

https://tensorflow.google.cn/programmers_guide/saved_model (英文原版)

https://tensorflow.google.cn/programmers_guide/saved_model?hl=zh-CN (中文原版)

1. 保存与恢复变量 (即 Checkpoint)

1.1 保存变量

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
import tensorflow as tf

# build network
# ...

# define checkpoint saver
saver = tf.train.Saver()

with tf.Session() as sess:
    # init variables
    sess.run(tf.global_variables_initializer())

    # 保存 checkpoint
    saver.save(sess, save_path="/path/to/save/checkpoints", global_step=tf.train.get_global_step())

说明: save_path 是到文件名层面的。若保存路径设为"/data/model",则 checkpoint 的文件以"/data/model-{global_step}“开头。一次会生成三个文件,分别以"data-00000-of-00001”、“index”、“meta"为扩展名。