Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
keras-smoke-detection
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ar-noc
keras-smoke-detection
Commits
7a1ee166
Commit
7a1ee166
authored
4 years ago
by
b1jeong
Browse files
Options
Downloads
Plain Diff
split scripts
parents
339e1d63
d1b7b6d9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#9542
passed
4 years ago
Stage: build-and-push
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
kerasDeloyment.yaml
+9
-9
9 additions, 9 deletions
kerasDeloyment.yaml
wildfireDemo/README.md
+1
-0
1 addition, 0 deletions
wildfireDemo/README.md
wildfireDemo/model_apply.ipynb
+2
-2
2 additions, 2 deletions
wildfireDemo/model_apply.ipynb
with
12 additions
and
11 deletions
kerasDeloyment.yaml
+
9
−
9
View file @
7a1ee166
...
...
@@ -44,12 +44,12 @@ spec:
persistentVolumeClaim
:
claimName
:
modeltraining
affinity
:
nodeAffinity
:
requiredDuringSchedulingIgnoredDuringExecution
:
nodeSelectorTerms
:
-
matchExpressions
:
-
key
:
gpu-type
operator
:
In
# Use NotIn for other types
values
:
-
M40
#
affinity:
#
nodeAffinity:
#
requiredDuringSchedulingIgnoredDuringExecution:
#
nodeSelectorTerms:
#
- matchExpressions:
#
- key: gpu-type
#
operator: In # Use NotIn for other types
#
values:
#
- M40
This diff is collapsed.
Click to expand it.
wildfireDemo/README.md
0 → 100644
+
1
−
0
View file @
7a1ee166
to use this demo, go to the notebook provided and enter the correct pathway to the model (h5 file) and the image directory. Everything else should be provided.
\ No newline at end of file
This diff is collapsed.
Click to expand it.
wildfireDemo/
utilitization
.ipynb
→
wildfireDemo/
model_apply
.ipynb
+
2
−
2
View file @
7a1ee166
...
...
@@ -62,8 +62,8 @@
"metadata": {},
"outputs": [],
"source": [
"pathToModel = \"/
userdata/kerasData/
firstSplitmodel.h5\"\n",
"pathToImageDir = \"/
userdata/kerasData/
images/setForLk\""
"pathToModel = \"/firstSplitmodel.h5\"\n",
"pathToImageDir = \"/images/setForLk\""
]
},
{
...
...
%% Cell type:code id: tags:
```
python
import
tensorflow
as
tf
import
os
from
PIL
import
Image
import
numpy
as
np
import
cv2
import
re
```
%% Cell type:code id: tags:
```
python
tf
.
test
.
is_built_with_cuda
()
tf
.
test
.
is_gpu_available
(
cuda_only
=
False
,
min_cuda_compute_capability
=
None
)
```
%% Output
True
%% Cell type:code id: tags:
```
python
test
=
np
.
array
([
1
,
2
,
3
,
4
])
test
/
4
```
%% Output
array([0.25, 0.5 , 0.75, 1. ])
%% Cell type:code id: tags:
```
python
pathToModel
=
"
/
userdata/kerasData/
firstSplitmodel.h5
"
pathToImageDir
=
"
/
userdata/kerasData/
images/setForLk
"
pathToModel
=
"
/firstSplitmodel.h5
"
pathToImageDir
=
"
/images/setForLk
"
```
%% Cell type:code id: tags:
```
python
def
loadData
(
datasetPath
):
tempF
=
[]
fireLabel
=
[]
for
element
in
os
.
listdir
(
datasetPath
):
if
re
.
search
(
'
\+
'
,
element
):
fireLabel
.
append
(
1
)
else
:
fireLabel
.
append
(
0
)
image
=
cv2
.
imread
(
datasetPath
+
"
/
"
+
element
)
image
=
cv2
.
resize
(
image
,
(
128
,
128
))
tempF
.
append
(
image
)
labels
=
np
.
array
(
fireLabel
)
labels
=
tf
.
keras
.
utils
.
to_categorical
(
labels
,
num_classes
=
2
)
data
=
np
.
array
(
tempF
)
data
=
np
.
true_divide
(
data
,
255
)
return
data
,
labels
data
,
Label
=
loadData
(
pathToImageDir
)
# cv2.imread("/userdata/kerasData/images/setForLk/1512676384_+02400.jpg")
```
%% Cell type:code id: tags:
```
python
model
=
tf
.
keras
.
models
.
load_model
(
pathToImageDirectory
)
```
%% Cell type:code id: tags:
```
python
model
.
predict
(
data
)
```
%% Output
array([[0.5107457 , 0.4892543 ],
[0.41123033, 0.5887697 ],
[0.43183708, 0.56816286],
[0.44897774, 0.55102223],
[0.47739947, 0.52260053],
[0.3578842 , 0.6421158 ],
[0.4941746 , 0.5058254 ],
[0.34056282, 0.6594372 ],
[0.35624158, 0.64375836],
[0.47470272, 0.5252973 ],
[0.4808885 , 0.5191116 ],
[0.431317 , 0.568683 ],
[0.5134212 , 0.4865788 ],
[0.40128127, 0.59871876],
[0.4639625 , 0.53603756],
[0.35375822, 0.64624184],
[0.36264202, 0.63735795],
[0.45890424, 0.5410958 ],
[0.33185333, 0.66814667],
[0.3523977 , 0.6476023 ],
[0.34115818, 0.6588418 ],
[0.48866385, 0.5113361 ],
[0.455409 , 0.544591 ],
[0.46895435, 0.5310457 ],
[0.38263088, 0.6173691 ],
[0.5233783 , 0.47662166],
[0.44299665, 0.5570033 ],
[0.47639135, 0.5236086 ],
[0.3761411 , 0.6238589 ],
[0.47419727, 0.52580273],
[0.40086877, 0.5991312 ],
[0.48351654, 0.5164834 ],
[0.43688735, 0.5631126 ],
[0.4520515 , 0.5479485 ],
[0.3890876 , 0.6109124 ],
[0.4929448 , 0.50705516],
[0.35062018, 0.64937985],
[0.46544933, 0.53455067],
[0.4987746 , 0.5012254 ],
[0.4678061 , 0.53219396],
[0.468355 , 0.53164506],
[0.37291136, 0.62708867],
[0.5106242 , 0.4893759 ],
[0.4318202 , 0.5681798 ],
[0.39998996, 0.60001004],
[0.40117145, 0.59882855],
[0.45087582, 0.5491242 ],
[0.3823646 , 0.6176354 ],
[0.3389846 , 0.6610154 ],
[0.36759573, 0.63240427],
[0.4042852 , 0.5957148 ],
[0.39802316, 0.6019768 ],
[0.34497583, 0.6550242 ],
[0.4933747 , 0.5066253 ],
[0.4834825 , 0.51651746],
[0.43642092, 0.5635791 ],
[0.47396407, 0.52603596],
[0.4887493 , 0.5112507 ],
[0.47656032, 0.52343965],
[0.46176285, 0.53823715],
[0.37929055, 0.6207095 ],
[0.49937135, 0.50062865],
[0.48522255, 0.5147774 ],
[0.45080933, 0.5491907 ],
[0.46133736, 0.5386627 ],
[0.39081547, 0.60918456],
[0.41144982, 0.58855015],
[0.52494085, 0.47505915],
[0.38156646, 0.61843354],
[0.36862728, 0.6313727 ],
[0.4544768 , 0.5455232 ],
[0.34168276, 0.6583172 ],
[0.37399516, 0.6260049 ],
[0.47957534, 0.52042466],
[0.50483143, 0.49516863],
[0.4877852 , 0.5122148 ],
[0.42307466, 0.57692534],
[0.51999307, 0.4800069 ],
[0.39840838, 0.60159165],
[0.4879313 , 0.5120687 ],
[0.4254754 , 0.57452464]], dtype=float32)
%% Cell type:code id: tags:
```
python
print
(
model
.
evaluate
(
x
=
data
,
y
=
Label
))
print
(
model
.
metrics_names
)
```
%% Output
81/1 [==============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================] - 0s 588us/sample - loss: 0.5996 - accuracy: 0.5926
[0.6112031642301583, 0.5925926]
['loss', 'accuracy']
%% Cell type:code id: tags:
```
python
```
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment