Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Ortner, Joshua
ai4hdr_backend
Commits
e68b397c
Commit
e68b397c
authored
Feb 04, 2021
by
josh
Browse files
modularizing the ml pipeline
parent
77a69531
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
.ipynb_checkpoints/Untitled-checkpoint.ipynb
View file @
e68b397c
%% 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: execute_result
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
)
```
%% 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
)
```
%% Cell type:code id: tags:
```
python
```
%% Cell type:code id: tags:
```
python
```
%% Cell type:code id: tags:
```
python
```
...
...
HDRModelTest.ipynb
0 → 100644
View file @
e68b397c
This diff is collapsed.
Click to expand it.
Untitled.ipynb
0 → 100644
View file @
e68b397c
%% 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: error
---------------------------------------------------------------------------
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: error
---------------------------------------------------------------------------
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
```
trainModel.py
View file @
e68b397c
...
...
@@ -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"
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment