A Pen by Stephan Osterburg on CodePen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| model = Sequential([ | |
| Conv2D(32, (3, 3), input_shape=input_shape, activation='relu'), | |
| MaxPooling2D(pool_size=(2, 2)), | |
| Dropout(0.2), | |
| Conv2D(32, (3, 3), activation='relu'), | |
| MaxPooling2D(pool_size=(2, 2)), | |
| Dropout(0.2), | |
| Conv2D(64, (3, 3), activation='relu'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| model = models.Sequential([ | |
| Conv2D(32, (3, 3), activation='relu', input_shape=(150, 150, 3)), | |
| MaxPooling2D((2, 2)), | |
| Conv2D(64, (3, 3), activation='relu'), | |
| MaxPooling2D((2, 2)), | |
| Flatten(), | |
| Dense(64, activation='relu'), | |
| Dense(128, activation='relu'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| '''This script goes along the blog post | |
| "Building powerful image classification models using very little data" | |
| from blog.keras.io. | |
| It uses data that can be downloaded at: | |
| https://www.kaggle.com/c/dogs-vs-cats/data | |
| In our setup, we: | |
| - created a data/ folder | |
| - created train/ and validation/ subfolders inside data/ | |
| - created cats/ and dogs/ subfolders inside train/ and validation/ | |
| - put the cat pictures index 0-999 in data/train/cats |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| '''This script goes along the blog post | |
| "Building powerful image classification models using very little data" | |
| from blog.keras.io. | |
| It uses data that can be downloaded at: | |
| https://www.kaggle.com/c/dogs-vs-cats/data | |
| In our setup, we: | |
| - created a data/ folder | |
| - created train/ and validation/ subfolders inside data/ | |
| - created cats/ and dogs/ subfolders inside train/ and validation/ | |
| - put the cat pictures index 0-999 in data/train/cats |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| '''This script goes along the blog post | |
| "Building powerful image classification models using very little data" | |
| from blog.keras.io. | |
| It uses data that can be downloaded at: | |
| https://www.kaggle.com/c/dogs-vs-cats/data | |
| In our setup, we: | |
| - created a data/ folder | |
| - created train/ and validation/ subfolders inside data/ | |
| - created cats/ and dogs/ subfolders inside train/ and validation/ | |
| - put the cat pictures index 0-999 in data/train/cats |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 'This is a test' should equal 'ThIs Is A TeSt' | |
| def to_weird_case_word(string): | |
| return "".join(c.upper() if i%2 == 0 else c for i, c in enumerate(string.lower())) | |
| def to_weird_case(string): | |
| return " ".join(to_weird_case_word(str) for str in string.split()) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # The mode is the value that shows up the most in a dataset. A dataset can have 0 or more modes. | |
| # If no value shows up more than once, the dataset is considered to have no mode value. | |
| # If two numbers show up the same number of times, that dataset is considered bimodal. | |
| # Datasets where multiple values all show up the same number of times are considered multimodal. | |
| def get_mode(data): | |
| most = max(list(map(data.count, data))) | |
| return list(set(filter(lambda x: data.count(x) == most, data))) |
A Pen by Stephan Osterburg on CodePen.
A Pen by Stephan Osterburg on CodePen.