Anaconda Cheat Sheet
https://docs.conda.io/projects/conda/en/4.6.0/_downloads/52a95608c49671267e40c689e0bc00ca/conda-cheatsheet.pdf
Update
If you wanted to update you will type
conda update python
To update anaconda type
conda update anaconda
Anaconda Cheat Sheet
https://docs.conda.io/projects/conda/en/4.6.0/_downloads/52a95608c49671267e40c689e0bc00ca/conda-cheatsheet.pdf
Update
If you wanted to update you will type
conda update python
To update anaconda type
conda update anaconda
Git Clone
Issues
1. AttributeError: module 'cv2.dnn' has no attribute 'DNN_BACKEND_INFERENCE_ENGINE'
Resolution: Update opencv
- identify current opencv version
print(cv2.__version__)
Updated-Deep Learning is an attempt to copy the pattern detection ability of a human brain, the main cause of pattern detection is Neural Networks in our brain.
5 # The shape is []
[ 1., 2., 3., 4. ] # The shape is [4]
# Matrix of shape [ 2, 4]
[ [ 1., 2., 3., 4. ], [ 5., 6., 7., 8. ] ]
# Tensor of shape [ 2, 1, 4 ]
[ [ [ 1., 2., 3., 4. ] ], [ [ 5., 6., 7., 8. ] ] ]
Tensor a mathematical object analogous to but more general than a vector, represented by an array of components that are functions of the coordinates of a space.
% lsmagic
in a cell you get a list of all the available magics. You can use %
to start a single-line expression to run with the magics command. Or you can use a double %%
to run a multi-line expression.% env
to list your environment variables.!
: to run a shell command. E.g., ! pip freeze | grep pandas
to see what version of pandas is installed.% matplotlib inline
to show matplotlib plots inline the notebook.% pastebin 'file.py'
to upload code to pastebin and get the url returned.% bash
to run cell with bash in a subprocess.%time
will time whatever you evaluate%%latex
to render cell contents as LaTeX%timeit
will time whatever you evaluate multiple times and give you the best, and the average times%prun
, %lprun
, %mprun
can give you line-by-line breakdown of time and memory usage in a function or script. See a good tutorial here.%% HTML
: to render the cell as HTML. So you can even embed an image or other media in your notebook:rmagics
extension.%Rpush
and %Rpull
to move values back and forth between R and Python:batchdemo.ipynb
, Domino will calculate the notebook and update its cells with the newest results.1 | ipython nbconvert --to html pipelinedashboard.ipynb |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# import the necessary packages
import imutils
def pyramid(image, scale=1.5, minSize=(30, 30)):
# yield the original image
yield image
# keep looping over the pyramid
while True:
# compute the new dimensions of the image and resize it
w = int(image.shape[1] / scale)
image = imutils.resize(image, width=w)
# if the resized image does not meet the supplied minimum
# size, then stop constructing the pyramid
if image.shape[0] < minSize[1] or image.shape[1] < minSize[0]:
break
# yield the next image in the pyramid
yield image
|
1
|
$ pip install imutils
|
1
2
3
4
5
6
7
8
9
|
# METHOD #2: Resizing + Gaussian smoothing.
for (i, resized) in enumerate(pyramid_gaussian(image, downscale=2)):
# if the image is too small, break from the loop
if resized.shape[0] < 30 or resized.shape[1] < 30:
break
# show the resized image
cv2.imshow("Layer {}".format(i + 1), resized)
cv2.waitKey(0)
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# import the necessary packages
from pyimagesearch.helpers import pyramid
from skimage.transform import pyramid_gaussian
import argparse
import cv2
# construct the argument parser and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required=True, help="Path to the image")
ap.add_argument("-s", "--scale", type=float, default=1.5, help="scale factor size")
args = vars(ap.parse_args())
# load the image
image = cv2.imread(args["image"])
# METHOD #1: No smooth, just scaling.
# loop over the image pyramid
for (i, resized) in enumerate(pyramid(image, scale=args["scale"])):
# show the resized image
cv2.imshow("Layer {}".format(i + 1), resized)
cv2.waitKey(0)
# close all windows
cv2.destroyAllWindows()
# METHOD #2: Resizing + Gaussian smoothing.
for (i, resized) in enumerate(pyramid_gaussian(image, downscale=2)):
# if the image is too small, break from the loop
if resized.shape[0] < 30 or resized.shape[1] < 30:
break
# show the resized image
cv2.imshow("Layer {}".format(i + 1), resized)
cv2.waitKey(0)
|
1
|
$ python pyramid.py --image images/adrian_florida.jpg --scale 1.5
|