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
| from os import listdir | |
| from PIL import Image | |
| for filename in listdir('data/images/'): | |
| try: | |
| img = Image.open('./data/images/'+filename) # open the image file | |
| img.verify() # verify that it is, in fact an image | |
| except (IOError, SyntaxError) as e: | |
| print('Bad file:', filename) # print out the names of corrupt files | |
| os.remove('./data/documents/'+filename) |
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
| {"format": "layers-model", "generatedBy": "keras v2.4.0", "convertedBy": "TensorFlow.js Converter v2.5.0", "modelTopology": {"keras_version": "2.4.0", "backend": "tensorflow", "model_config": {"class_name": "Sequential", "config": {"name": "sequential", "layers": [{"class_name": "InputLayer", "config": {"batch_input_shape": [null, 20], "dtype": "float32", "sparse": false, "ragged": false, "name": "embedding_input"}}, {"class_name": "Embedding", "config": {"name": "embedding", "trainable": true, "batch_input_shape": [null, 20], "dtype": "float32", "input_dim": 10000, "output_dim": 16, "embeddings_initializer": {"class_name": "RandomUniform", "config": {"minval": -0.05, "maxval": 0.05, "seed": null}}, "embeddings_regularizer": null, "activity_regularizer": null, "embeddings_constraint": null, "mask_zero": false, "input_length": 20}}, {"class_name": "Bidirectional", "config": {"name": "bidirectional", "trainable": true, "dtype": "float32", "layer": {"class_name": "LSTM", "config": {"name": "lstm", "trainable": t |
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
| import tensorflow as tf | |
| frozen_graph = tf.compat.v1.keras.backend.get_session().graph | |
| tf.io.write_graph(frozen_graph, "/content/drive/My Drive/data/", "model.pb", as_text=False) |
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
| import glob | |
| from random import shuffle | |
| import h5py | |
| import numpy as np | |
| import cv2 | |
| import math | |
| import time | |
| import matplotlib.pyplot as plt | |
| %matplotlib inline |
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
| FOR /F "delims=~" %f in (requirements.txt) DO conda install --yes "%f" || pip install "%f" |
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
| #Creation and configuration of the logger | |
| LOG_FORMAT = "%(levelname)s %(asctime)s - %(message)s" | |
| logging.basicConfig(filename = "log.txt", | |
| level = logging.DEBUG, #you can change DEBUG to : INFO,WARNING,ERROR,CRITICAL | |
| format = LOG_FORMAT, | |
| filemode = 'w') | |
| logger = logging.getLogger() | |
| # here is the diferent level you can use | |
| #logger.debug("") | |
| #logger.info("") |
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
| Y = np.zeros((5,), dtype=int) | |
| Y = pd.cut(train_y, bins=[-1,25,50,75,100,np.inf], labels=[(1,0,0,0,0),(0,1,0,0,0),(0,0,1,0,0),(0,0,0,1,0),(0,0,0,0,1)]) | |
| train_y = Y |
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
| import numpy as np | |
| #the tree following line allow you to save the train data in a file data.npy | |
| np.save("data.npy", X,allow_pickle=True) | |
| #loading the file | |
| X = np.load("fooooo.npy") |
NewerOlder