python
tkinter.Tk()root(メインウィンドウ?)の作成rootにwidgetを配置していく tkinter.Tk().mainloop()メインの処理を実行 geometryウィンドウのサイズや位置を設定まさにgeometry widgetの配置widget(オブジェクト)を作成する時は,1. 作成するwidgetの親widget…
It's super simple with Anaconda.The official instruction says the following command is fine $ conda install kivy -c conda-forge The above command installs kivy and its components. The tutorial Pong game works on my computer.
[code lang='python']import cv2video = cv2.VideoCapture('input.mp4')num_frames = int(video.get(cv2.CAP_PROP_FRAME_COUNT))fps = video.get(cv2.CAP_PROP_FPS)width = int(video.get(cv2.CAP_PROP_FRAME_WIDTH))height = int(video.get(cv2.CAP_PROP_FR…
ArUco is a fiducial marker tracking method against occlusion published in Pattern Recognition in 2014. ArUco was integrated into OpenCV modules. This blog post is to know its definition, how-to-use, etc. for my works. ArUco provides three …
I was looking for a way to install OpenCV and OpenCV contrib for Python 3 with Anaconda. The following commands are what I found and succeeded to install but with pip not with Anaconda. pip install opencv-python pip install opencv-contrib-…
[code lang='python'] -- coding: utf-8 -- import os import numpy as np import glob import cv2 def generate_points_3d(rows, cols, square_size): """ prepare object points as ( 0, 0, 0), (1square_size, 0, 0), (2square_size, 0, 0), ... *1 img =…
spyder --reset [code lang='bash'] Reset Spyder settings to defaults removing: C:\Users\oyamada.AR-DUNE-1.spyder-py3\spyder.ini removing: C:\Users\oyamada.AR-DUNE-1.spyder-py3\history_internal.py removing: C:\Users\oyamada.AR-DUNE-1.spyder-…
This stackoverflow post gives us the answer!! OpenCV for python installed on Linux (Ubuntu) by anaconda outputs GTK+2.x related error as OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GT…
I just wrote a simple code to visualize trained filters and feature maps of pytorch. For simplicity, the below code uses pretrained AlexNet but the code must work with any network with Conv2d layers. [code lang="python"] !/usr/bin/env pyth…
See here. conda install -c anaconda opencv
OpenCV-Pythonチュートリアルの和訳を2.5年ぶりに更新. 和訳は以前と同じURLからアクセス可能です. ソースはgithubからgitlabに移行しました. 誤訳,変な訳があればgitlabにイシュー登録してもらえるとハッピーです.
conda install ... opencv, conda install ... opencv-python ruined my environment built on Windows 10. The error seemed to related to PyQt and authentication/path setting but couldn't specify the true cause. So, instead of using anaconda bin…
OpenCV installation on Windows via Anaconda with conda -c conda-forge opencv makes import error like ImportError: DLL load failed: access denied. The solution is to use pip instead as pip install opencv-python.
See this. The process is super simple. stack a set of strings into a list. define a function converts a string object to its corresponding int object. define a function runs through a list to extract numbers from strings. sort a list with …
See the tutorial. Important note: torchvision provides several pre-trained models with their trained parameters. AlexNet, DenseNet, Inception, ResNet, VGG are available, see here. With pretrained=True, pre-trained parameters are available.…
I got a runtime error at evaluation phase of my simple siamese network as RuntimeError: cuda runtime error (2) : out of memory at the line of executing forward pass. Some comments on stackoverflow suggests to define x and y with volatile=T…
See spyder's issue. For my case, installing PyOpenGL fixed the error as conda install pyopengl
See this tutorial. Set requires_grad=True for all tensors we compute gradients w.r.t. them. [code lang='python'] input and output x = torch.randn(N, D_in, device=device, dtype=dtype) y = torch.randn(N, D_out, device=device, dtype=dtype) pa…
See the tutorial. It's quite simple (Keras provides simpler interface though). A neural network is defined as a class that has a forward function. The forward function defines how input data is processed through the network. PyTorch automa…
Super easy installation GUI on the web as below
Inspired by this stackoverflow answer and keras.callbacks.CSVLogger, I implemented a callback function to save loss on each batch. [code lang='python'] class LossHistory(Callback): def __init__(self, filename, separator=',', append=False):…
I got "ImportError of libcudnn.so.6" after Ubuntu apt update although I have no idea how apt update causes the error. The solution is re-install cuDNN. Library files of cuDNN disappeared from a directory where is one of LD_LIBRARY_PATH. So…
pyntcloud is a package to work with 3D point cloud in Python 3. You can install using anaconda as: pip install -i https://pypi.anaconda.org/pypi/simple laspy pip install git+https://github.com/daavoo/pyntcloud
Tensorflow 1.4.0 binary with CUDA 8 and cuDNN 6 Tensorflow 1.5.0 binary will be with CUDA 9 and cuDNN 7 The following procedure assumes that you use anaconda for python package manager. prepare for driver install Delete installed drivers b…
"pip install keras" returns the following TypeError. The solution found at StackOverflow says to 1. install html5lib by conda install --force html5lib 2. install keras by pip install keras
Keras implementation for MNIST classification with batch normalization and leaky ReLU. [code lang="python"] import numpy as np import time import pandas as pd import matplotlib.pyplot as plt from keras.datasets import mnist from keras.mode…
When Keras' model contains Dropout component in it, we must tell the model whether we are training or test mode because the network behaves differently. The solution is mentioned in github issue and Keras docs. [code lang="python"] from ke…
plot_model of Keras installed on Windows may return pydot and graphviz related error like "Graphviz's executables are not found'. The error cause is that the computer does not know the path of Graphviz's executable exactly mentioned as the…
We need the appropriate cuDNN and this kind of import error occurred by missing the right version. See this release note. TensorFlow 1.3.0 (and other prebuilt binaries) have been built with cuDNN 6 and TensorFlow 1.4 with cuDNN 7. cuDNN in…
[code lang="python"] for layer in model.layers layer_name = layer.get_config()['name'] print(layer_name) if layer_name is 'foo': print('foo') else: print('bar') [/code]