mixmixmix / learnmachine Goto Github PK
View Code? Open in Web Editor NEWVariety Machine Learning Course for curious.
Variety Machine Learning Course for curious.
Make a different environment for TF
KeyError Traceback (most recent call last)
in
16 image_size = 64 # in pixels
17 number_of_classes = 2 #2-6 - normal blobs. 7-11 more difficult
---> 18 problem = generateBlobsData(imageDir, number_of_classes, number_of_samples, image_size, noiseSize=20)
~\OneDrive - Indian Institute of Science\Side\2020-03 Machine-Learning Mix\tasks\utils\practice_data.py in generateBlobsData(imageDir, noClasses, trainSamples, imSize, noiseSize, colour)
98 print(blob_file)
99 blob_class = blob_file.split("/")[-1].split("_")[0]
--> 100 blob_class_int=intblobclass[blob_class]
101 if(noClasses <= blob_class_int):
102 continue
KeyError: 'simple'
print('Correct classification of Logistic Regression: {0.2%}'.format(trueRate)) # Works for 2 cell types only
There is sometimes a mismatch between libraries used by different OpenCV versions on your computer.
For instance I originally had 4.1.0
and the following code for loading image works fine:
import cv2
print(cv2.__version__)
a = cv2.imread('./assets/simple_blobs/bloby_478.png')
print(type(a))
4.1.0
numpy.ndarray
However, when I created a new virtual environment with conda-forge::opencv=4.1.2
the png image won't load. The same code produces
4.1.2
NoneType
Without raising any errors.
However when running the same code in REPL we can see the warning that explains everything:
libpng warning: Application built with libpng-1.4.12 but running with 1.6.37
Different versions of opencv are built with different versions of png libraries but they are somehow forced to use the same version, or are outright broken.
That causes first cell in Task B to fail with the following error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-1-147208002c1c> in <module>
16 image_size = 64 # in pixels
17 number_of_classes = 2 #2-6 - normal blobs. 7-11 more difficult
---> 18 problem = generateBlobsData(imageDir, number_of_classes, number_of_samples, image_size, noiseSize=20)
~/repos/learnmachine/tasks/utils/practice_data.py in generateBlobsData(imageDir, noClasses, trainSamples, imSize, noiseSize, colour)
106 #add noise
107 if noiseSize>0:
--> 108 row,col,ch= blob_image.shape
109 gauss = np.random.normal(0,noiseSize,(row,col,ch))
110 gauss = gauss.reshape(row,col,ch)
AttributeError: 'NoneType' object has no attribute 'shape'
If you encounter it, try re-setting environment with different version of OpenCV.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.