- 博客(35)
- 收藏
- 关注
原创 pytorch从dataloader中取数据 (python从enumerate或iterator对象中取数据)
报错:TypeError: 'enumerate' object is not subscriptableTypeError: 'DataLoader' object is not an iterator代码:_, (inputs2, labels2) = next(enumerate(test2))_, (inputs3, labels3) = next(enumerate(test3))iter应该同理。next(iter(test3))enumerate还可以加索引...
2020-08-31 16:08:21 9690 5
翻译 vs 2017 release无法调试
第三步:工具–>选项—>调试---->常规–>禁用"启动仅我的代码"https://blog.csdn.net/chinmusam/article/details/7879140
2020-08-31 14:50:47 1147
原创 python找不到包,ModuleNotFoundError: No module named
明明添加了 init.py文件了,还是找不到检查本地代码是否已经同步到了服务器端加入路径。此方法不需要什么 init.py文件目录结构:__project |__ dira |__a.py # a引用b |__dirb |__b.py # 定义了fun1() c.py # c引用d d.py # 定义了fun2()代码:a.py# a.py要引用dirb文件夹中的b.py中定义的的fun1()函数sys.path.append(r'../../')from dirb
2020-08-26 18:36:31 2579
翻译 python lambda函数 filter函数
老是记不住lambda 参数:表达式>>> c = lambda x:x**3>>> c(2)8
2020-08-26 17:28:45 234
翻译 linux ubuntu bash shell报错 xxx.sh: Syntax error: end of file unexpected (expecting “then“)
代码:# creat log dir if it not existslogDir="./ckpt/"$timeDirif [ ! -d $logDir ]; then mkdir $logDirelse echo $logDir existfi报错:$ sh run.sh: not foundrun.sh:run.sh: 16: run.sh: Syntax error: end of file unexpected (expecting "then")解决:需要转换脚
2020-08-26 14:56:20 1145
原创 windows win10 pycharm安装bash support插件
在pycharm软件内部商店搜不到只能手动安装下载:https://plugins.jetbrains.com/plugin/4230-bashsupport/versions/stable安装:file - settings- Plugins - 齿轮- install plugin from disk… - 选择下载的zip文件 - restart IDE
2020-08-26 13:39:42 1741
原创 各种配置文件语法扫盲:YAML
不能用tab缩进,只能用空格多层字典嵌套:tasknum: # 注意要使用空格进行缩进 '1': # 多个小横杠 - 实现一个列表 - bitsPerAttr: 40实现的是:'tasknum': {'1': [{'bitsPerAttr': 40}],
2020-08-26 11:44:53 326
原创 tensorflow keras InvalidArgumentError: Default MaxPoolingOp only supports NHWC on device type CPU
tf.version ‘2.3.0’keras.version ‘2.4.3’tensoflow代码:out = model.predict(x_test)out = np.array(out)报错:---------------------------------------------------------------------------InvalidArgumentError Traceback (most recent call las
2020-08-21 15:16:32 8018 1
翻译 mac book air自动重启/自动注销
一会不用它就变得很干净了,像重启过长时间的网页连接也会断掉,很麻烦其实是自动注销了。在安全与隐私中 重新设置:系统偏好设置->安全性与隐私->点击小锁->右下角 高级 按钮 -> 设置自动注销时间https://www.ancii.com/abvzgmub7/...
2020-08-20 15:35:18 604
原创 linux ubuntu scp Host key verification failed
一开始我(user2)在 456.xxx.xxx.xx 机器上执行命令:$ sudo scp -r user1@123.xxx.xxx.xx:/home/user1/folder1 user2@456.xxx.xxx.xx:/home/user2/folder2/想把123.xxx.xxx.xx 机器上的文件夹folder1拷贝到 456.xxx.xxx.xx 机器的folder2下面,但是报错:user1@123.xxx.xxx.xx's password:Host key verificati
2020-08-18 18:29:24 331
原创 python读取图片 PIL, matplotlib(plt.imshow) 、cv2.imread和skimage.imread 打开和显示图片的区别(shape,通道)
区别:PIL:(宽,高)cv2:(高,宽)原图:1920x1080Image.open(imgPath):(1920, 1080)cv2.imread(imgPath,0):(1080, 1920)
2020-08-17 22:48:55 4861
原创 mxnet sklearn ValueError: Input contains NaN, infinity or a value too large for dtype(‘float64‘).
Traceback (most recent call last): File "train_0723.py", line 455, in <module> main() File "train_0723.py", line 451, in main train_net(args) File "train_0723.py", line 445, in train_net epoch_end_callback=epoch_cb) File "/home/us
2020-08-17 11:39:41 560
原创 linux ubuntu apt-get报错E: Unable to correct problems, you have held broken packages.
报错内容:$ sudo apt-get install lm-sensors sensors-appletReading package lists... DoneBuilding dependency treeReading state information... Donelm-sensors is already the newest version (1:3.3.4-2ubuntu1).Some packages could not be installed. This may mean
2020-08-17 11:25:23 2433
原创 mxnet训练卡死 重启后依然无法解决
3480 root 20 0 0 0 0 R 100.0 0.0 11:53.46 UVM GPU1 BH1724 root -51 0 0 0 0 R 100.0 0.0 11:59.19 irq/88-nvidia
2020-08-17 11:15:13 1157
原创 pytorch RuntimeError: expected backend CUDA and dtype Float but got backend CPU and dtype Float
代码:criterion = nn.BCEWithLogitsLoss(reduction='none')loss = criterion(output, target)loss.mul_(weights)报错:Traceback (most recent call last):File “/home/user1/main_cs_0708.py”, line 391, in main()File “/home/user1/main_cs_0708.py”, line 301, in mai
2020-08-14 17:46:08 2367
翻译 windows win10调节外接显示器亮度
安装显卡驱动,在显卡应用程序里面调如英特尔的显卡桌面应用程序https://www.cnblogs.com/anyefrozen/p/11275485.html
2020-08-13 15:44:25 7147
翻译 pytorch tensor操作
1,增加维度>>> a = torch.tensor([222])>>> atensor([222])>>> a.shapetorch.Size([1])# 变成1列>>> c = torch.unsqueeze(a,1) # torch.unsqueeze(a,0) 是变成一行>>> c.shapetorch.Size([1, 1])
2020-08-12 16:37:22 946
原创 pytorch网络结构可视化graphviz.backend.ExecutableNotFound: failed to execute [‘dot‘, ‘-Tpdf‘, ‘-O‘, ‘
报错:Traceback (most recent call last): File "/data/user1/pkgs/conda/envs/drc/lib/python3.7/site-packages/graphviz/backend.py", line 129, in render subprocess.check_call(args, stderr=stderr, **POPEN_KWARGS) File "/data/user1/pkgs/conda/envs/drc/lib/
2020-08-12 15:14:51 1466
原创 linux ubuntu 升级sklearn 0.19
sklearn 0.19各种报错还不能升级:报错1(使用时报错):ImportError: cannot import name 'multilabel_confusion_matrix'报错2(升级时报错):$ pip install git+http://github.com/scikit-learn/scikit-learn.gitLooking in indexes: https://mirrors.aliyun.com/pypi/simple/, https://pypi.tuna.t
2020-08-11 23:57:26 708
原创 修改conda某个虚拟环境的python解释器interpreter
# 进入环境$ conda activate your_env# 查看特定环境的环境变量设置$ conda env config # 修改某个环境变量$ conda env config vars set CONDA_PYTHON_EXE=/home/data/pkgs/miniconda3/bin/python# 使变量生效$ conda activate your_envhttps://conda.io/projects/conda/en/latest/user-guide/tasks
2020-08-10 22:20:24 3920
翻译 linux ubuntu bash shell报错 xxx.sh: Syntax error: “(“ unexpected
原因可能是你使用了sh而不是bash去运行你的脚本,sh没有数组定义,而bash有bash脚本的开头应该为:#!/bin/bash运行命令为:$ sudo bash xxx.shsh脚本开头没有限制。运行命令为:$ sudo sh xxx.shhttps://unix.stackexchange.com/questions/253892/syntax-error-unexpected-when-creating-an-array...
2020-08-10 17:23:08 470
原创 MxNet base.h:459: Check failed: e == cudaSuccess (30 vs. 0) : CUDA: unknown error nvidia-smi显卡ERR!
命令输出缓慢,并且报ERR1,重启机器2,重装驱动3,维修或换显卡
2020-08-09 11:33:27 1242
翻译 UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figur
画图出不来UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.解决:import matplotlib.pyplot as pltplt.switch_backend('TkAgg')okie@https://stackoverflow.com/questions/56656777/userwarning-matplotlib-is-curre
2020-08-07 11:37:53 3406
原创 linux ubuntu 查找文件、文件夹、包含指定内容的文件 grep / locate / find
find 命令$ sudo find /home/ -name 'v2'查找:/home/xxx/data/86/images/v2/act-5/002822.jpg所在的位置:$ locate v2/act-5
2020-08-06 11:26:23 3326
原创 pytorch 每次测试结果不同
真是见了鬼了,搞好半天没弄清楚啥原因。把每个预测值看了一遍,确实每次结果不同。原因排查:自定义的Metric写的有问题,会根据batch_size变化,是按batch_size大小按每个batch分别计算的,而不是按batch累计的被测试的网络结构中有Dropout层,比如nn.Dropout测试的数据loader加入了随机处理,比如transforms.RandomCrop()其他可能的原因,目前我还没遇到。感谢:https://blog.csdn.net/t20134297/artic
2020-08-04 16:58:43 5926
翻译 代码差异比较 diff pycharm sublimetext
好用的代码比较工具:pycharmsublimetext安装:https://www.cnblogs.com/olive27/p/6038144.html用法:https://blog.csdn.net/a0405221/article/details/78769672https://www.diffchecker.com/ ?
2020-08-04 16:31:34 1311
翻译 linux ubuntu vi 编辑器按键异常
可能需要配置一下:https://blog.csdn.net/harbor1981/article/details/82428409
2020-08-03 17:18:07 368
翻译 IPython Jupyter Notebook方向键异常
方向键变成数字,试试关闭numlock锁定https://blog.csdn.net/Du_Shuang/article/details/77716611
2020-08-03 17:17:13 919
翻译 linux ubuntu终端terminal禁止在输出时自动滚动
在终端运行程序,如果程序不停地向终端输出内容,就没办法向上滚动查看之前的输出。这个可以通过以下步骤设置解决:terminal->右键->Profiles->Profile Preferences->Scrolling->取消选中 Scroll on output小技巧。感谢:https://qastack.cn/superuser/541106/how-to-scroll-up-in-terminal-window-while-new-input-is-generated
2020-08-03 14:15:04 2211
原创 python numpy二进制存取
根据数据特点,调整存储占用的空间大小。因为数组中全是0和1,所以用单字节(np.int8)存储。如果是浮点或其他格式,可以用其他类型。# 存>>> f = open(c, 'ab+')>>>> d1 = np.array([0,0,1], dtype=np.int8)>>> f.write(d1)3>>> d2 = np.array([0,1,1], dtype=np.int8)>>> f.wri
2020-08-03 14:05:04 1753
原创 mxnet mshadow/./stream_gpu-inl.h:62: Check failed: e == cudaSuccess: CUDA: an illegal memory access
报错:Traceback (most recent call last): File "train_0723.py", line 455, in <module> main() File "train_0723.py", line 451, in main train_net(args) File "train_0723.py", line 445, in train_net epoch_end_callback=epoch_cb) File "/hom
2020-08-03 09:56:50 754
翻译 linux ubuntu查看执行的命令历史记录 history
$ history设置显示的行数:$ sudo nano /etc/profule加入HISTTIMEFORMAT="%F %T `whoami` " # prefix of outputHISTSIZE=5000 # lines num in output of history commandHISTFILESIZE=5000 # lines num in .bash_history file# 生效$ source /etc/profile...
2020-08-02 12:13:11 4739
翻译 sudo dpkg 报错 E: Could not get lock /var/lib/dpkg/lock-frontend
报错:E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 8888 (aptd) - open (11: Resource temporarily unavailable)N: Be aware that removing the lock file is not a solution and may break your system.E: Unable to acquire the dpkg fronte
2020-08-02 11:42:31 2655
原创 Linux ubuntu18.04使用ubuntu-drivers autoinstall安装nvidia驱动后紫屏黑屏卡在主板logo无法进系统
ubuntu 18.04 GTX 1080TI 双显卡主要是显卡驱动的问题,解决过程(仅供参考):先尝试的安装450$ ubuntu-drivers devices$ sudo add-apt-repository ppa:graphics-drivers/ppa$ sudo apt-get update$ sudo apt update && sudo apt -f install && sudo apt full-upgrade注意几个问题:1,先解
2020-08-02 11:39:03 9394 1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人