Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
CHILD INTELLIGENT ASSESSMENT TOOL
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2020-046
CHILD INTELLIGENT ASSESSMENT TOOL
Commits
8f88754f
Commit
8f88754f
authored
Nov 03, 2020
by
Dasun Madushanka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update dmt_crash.dart
parent
0b75b698
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
lib/screens/details/dmt_crash.dart
lib/screens/details/dmt_crash.dart
+9
-6
No files found.
lib/screens/details/dmt_crash.dart
View file @
8f88754f
...
@@ -6,7 +6,7 @@ import 'package:image_picker/image_picker.dart';
...
@@ -6,7 +6,7 @@ import 'package:image_picker/image_picker.dart';
import
'package:tflite/tflite.dart'
;
import
'package:tflite/tflite.dart'
;
class
DMTCrash
extends
StatefulWidget
{
class
DMTCrash
extends
StatefulWidget
{
static
const
routeName
=
"dmt_crash"
;
static
const
routeName
=
"dmt_crash"
;
//add route,connect with product
@override
@override
_DMTCrashState
createState
()
=>
_DMTCrashState
();
_DMTCrashState
createState
()
=>
_DMTCrashState
();
}
}
...
@@ -27,7 +27,7 @@ class _DMTCrashState extends State<DMTCrash> {
...
@@ -27,7 +27,7 @@ class _DMTCrashState extends State<DMTCrash> {
});
});
});
});
}
}
//test results page
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
return
Scaffold
(
...
@@ -52,6 +52,7 @@ class _DMTCrashState extends State<DMTCrash> {
...
@@ -52,6 +52,7 @@ class _DMTCrashState extends State<DMTCrash> {
:
Container
(
:
Container
(
width:
MediaQuery
.
of
(
context
).
size
.
width
,
width:
MediaQuery
.
of
(
context
).
size
.
width
,
child:
Column
(
child:
Column
(
//add paddings
crossAxisAlignment:
CrossAxisAlignment
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
children:
[
...
@@ -64,7 +65,7 @@ class _DMTCrashState extends State<DMTCrash> {
...
@@ -64,7 +65,7 @@ class _DMTCrashState extends State<DMTCrash> {
"
${_outputs[0]["label"]}
"
,
"
${_outputs[0]["label"]}
"
,
style:
TextStyle
(
style:
TextStyle
(
color:
Colors
.
black
,
color:
Colors
.
black
,
fontSize:
20.0
,
fontSize:
20.0
,
//font size int text feild
background:
Paint
()..
color
=
Colors
.
white
,
background:
Paint
()..
color
=
Colors
.
white
,
),
),
)
)
...
@@ -72,13 +73,14 @@ class _DMTCrashState extends State<DMTCrash> {
...
@@ -72,13 +73,14 @@ class _DMTCrashState extends State<DMTCrash> {
],
],
),
),
),
),
//using the floating action button can select the images from gallery
floatingActionButton:
FloatingActionButton
(
floatingActionButton:
FloatingActionButton
(
onPressed:
pickImage
,
onPressed:
pickImage
,
child:
Icon
(
Icons
.
image
),
child:
Icon
(
Icons
.
image
),
),
),
);
);
}
}
//add images from gallery
pickImage
()
async
{
pickImage
()
async
{
var
image
=
await
ImagePicker
.
pickImage
(
source
:
ImageSource
.
gallery
);
var
image
=
await
ImagePicker
.
pickImage
(
source
:
ImageSource
.
gallery
);
if
(
image
==
null
)
return
null
;
if
(
image
==
null
)
return
null
;
...
@@ -88,7 +90,7 @@ class _DMTCrashState extends State<DMTCrash> {
...
@@ -88,7 +90,7 @@ class _DMTCrashState extends State<DMTCrash> {
});
});
classifyImage
(
image
);
classifyImage
(
image
);
}
}
//classify the image we took
classifyImage
(
File
image
)
async
{
classifyImage
(
File
image
)
async
{
var
output
=
await
Tflite
.
runModelOnImage
(
var
output
=
await
Tflite
.
runModelOnImage
(
path:
image
.
path
,
path:
image
.
path
,
...
@@ -102,7 +104,8 @@ class _DMTCrashState extends State<DMTCrash> {
...
@@ -102,7 +104,8 @@ class _DMTCrashState extends State<DMTCrash> {
_outputs
=
output
;
_outputs
=
output
;
});
});
}
}
//add model to assesst folder
//detect the object with model
loadModel
()
async
{
loadModel
()
async
{
await
Tflite
.
loadModel
(
await
Tflite
.
loadModel
(
model:
"assets/model_unquant.tflite"
,
model:
"assets/model_unquant.tflite"
,
...
...
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