Commit e68b397c authored by josh's avatar josh
Browse files

modularizing the ml pipeline

parent 77a69531
%% Cell type:code id: tags:
``` python
from modules.ai4hdrModel import *
import matplotlib.pyplot as plt
```
%% Cell type:code id: tags:
``` python
sampleDir = Path.cwd().joinpath("roadTest")
sampleDir
```
%% Output
PosixPath('/home/josh/projects/suli_fall2021/ai4hdr_backend/roadTest')
%% Cell type:code id: tags:
``` python
(xSamples, ySamples) = getSamples(sampleDir)
print(xSamples.shape)
print(ySamples.shape)
```
%% Output
(10, 128, 128, 3)
(10, 128, 128)
%% Cell type:markdown id: tags:
#
%% Cell type:code id: tags:
``` python
xTrain = xSamples[0:5,:,:,:]
yTrain = ySamples[0:5,:,:]
print("X TRAIN SHAPE:", xTrain.shape)
print("Y TRAIN SHAPE:", yTrain.shape)
xTest = xSamples[5:10,:,:,:]
yTest = ySamples[5:10,:,:]
print("X TEST SHAPE:", xTest.shape)
print("Y TEST SHAPE:", yTest.shape)
```
%% Output
X TRAIN SHAPE: (5, 128, 128, 3)
Y TRAIN SHAPE: (5, 128, 128)
X TEST SHAPE: (5, 128, 128, 3)
Y TEST SHAPE: (5, 128, 128)
%% Cell type:code id: tags:
``` python
```
%% Cell type:code id: tags:
``` python
```
%% Cell type:code id: tags:
``` python
```
......
This diff is collapsed.
%% Cell type:code id: tags:
``` python
import pickle
from pathlib import Path
from tensorflow import keras
```
%% Cell type:code id: tags:
``` python
VGG_DIR = "VGG16"
model = keras.models.load_model(VGG_DIR)
```
%% Output
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-13-164cb73ad621> in <module>()
1 VGG_DIR = "VGG16"
----> 2 model = keras.models.load_model(VGG_DIR)
/home/josh/anaconda3/envs/gpu_tf/lib/python3.6/site-packages/tensorflow_core/python/keras/saving/save.py in load_model(filepath, custom_objects, compile)
147
148 if isinstance(filepath, six.string_types):
--> 149 loader_impl.parse_saved_model(filepath)
150 return saved_model_load.load(filepath, compile)
151
/home/josh/anaconda3/envs/gpu_tf/lib/python3.6/site-packages/tensorflow_core/python/saved_model/loader_impl.py in parse_saved_model(export_dir)
81 (export_dir,
82 constants.SAVED_MODEL_FILENAME_PBTXT,
---> 83 constants.SAVED_MODEL_FILENAME_PB))
84
85
OSError: SavedModel file does not exist at: VGG16/{saved_model.pbtxt|saved_model.pb}
%% Cell type:code id: tags:
``` python
obj = pickle.load(inFile)
```
%% Output
---------------------------------------------------------------------------
UnpicklingError Traceback (most recent call last)
<ipython-input-7-9fbfa10e9190> in <module>()
----> 1 obj = pickle.load(inFile)
UnpicklingError: invalid load key, '\x0a'.
%% Cell type:code id: tags:
``` python
```
......@@ -18,10 +18,6 @@ def getSamples(dataDir: Path) -> [(np.array, np.array)]:
inputImage = Image.open(inputPath)
maskImage = Image.open(maskPath)
#newSize = (128, 128)
#resizeInput = inputImage.resize(newSize)
#resizeMask = maskImage.resize(newSize)
inputArr = np.array(inputImage)
maskArr = np.array(maskImage.convert("L"))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment