Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
Slicing Multithread 8250 app
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Quan
Slicing Multithread 8250 app
Commits
ad02e95b
Commit
ad02e95b
authored
Oct 21, 2021
by
Quan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
full flow mobile slicing person
parent
e8c3439a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
14 deletions
+17
-14
MobilenetDetector.java
...qti/snpe/imageclassifiers/detector/MobilenetDetector.java
+8
-8
AiSlicingThread.java
...omm/qti/snpe/imageclassifiers/thread/AiSlicingThread.java
+9
-6
mb1_ssd_sim.dlc
app/src/main/res/raw/mb1_ssd_sim.dlc
+0
-0
No files found.
app/src/main/java/com/qualcomm/qti/snpe/imageclassifiers/detector/MobilenetDetector.java
View file @
ad02e95b
...
...
@@ -103,14 +103,14 @@ public class MobilenetDetector {
Mat
frameCv
=
new
Mat
();
Bitmap
frame32
=
frame
.
copy
(
Bitmap
.
Config
.
ARGB_8888
,
true
);
Utils
.
bitmapToMat
(
frame32
,
frameCv
);
Mat
resizeimage
=
new
Mat
();
Size
sz
=
new
Size
(
MODEL_WIDTH
,
MODEL_HEIGHT
);
Imgproc
.
resize
(
frameCv
,
resizeimage
,
sz
);
Imgproc
.
cvtColor
(
resizeimage
,
resizeimage
,
Imgproc
.
COLOR_RGBA2RGB
);
//COLOR_RGBA2RGB
resizeimage
.
convertTo
(
resizeimage
,
CvType
.
CV_32F
);
//, 1.0, 0); //convert to 32F
Core
.
subtract
(
resizeimage
,
new
Scalar
(
127.0f
,
127.0f
,
127.0f
),
resizeimage
);
Core
.
divide
(
resizeimage
,
new
Scalar
(
128.0f
,
128.0f
,
128.0f
),
resizeimage
);
resizeimage
.
get
(
0
,
0
,
inputValues
);
//image.astype(np.float32)
//
Mat resizeimage = new Mat();
//
Size sz = new Size(MODEL_WIDTH,MODEL_HEIGHT);
//
Imgproc.resize( frameCv, resizeimage, sz );
Imgproc
.
cvtColor
(
frameCv
,
frameCv
,
Imgproc
.
COLOR_RGBA2RGB
);
//COLOR_RGBA2RGB
frameCv
.
convertTo
(
frameCv
,
CvType
.
CV_32F
);
//, 1.0, 0); //convert to 32F
Core
.
subtract
(
frameCv
,
new
Scalar
(
127.0f
,
127.0f
,
127.0f
),
frameCv
);
Core
.
divide
(
frameCv
,
new
Scalar
(
128.0f
,
128.0f
,
128.0f
),
frameCv
);
frameCv
.
get
(
0
,
0
,
inputValues
);
//image.astype(np.float32)
long
preProcessTime
=
System
.
currentTimeMillis
()-
preProcessStart
;
Log
.
d
(
LOGTAG
,
"Preprocess_time: "
+
preProcessTime
);
/**Preprocessing**/
...
...
app/src/main/java/com/qualcomm/qti/snpe/imageclassifiers/thread/AiSlicingThread.java
View file @
ad02e95b
package
com
.
qualcomm
.
qti
.
snpe
.
imageclassifiers
.
thread
;
import
static
com
.
qualcomm
.
qti
.
snpe
.
imageclassifiers
.
detector
.
MobilenetDetector
.
MODEL_HEIGHT
;
import
static
com
.
qualcomm
.
qti
.
snpe
.
imageclassifiers
.
detector
.
MobilenetDetector
.
MODEL_WIDTH
;
import
static
com
.
qualcomm
.
qti
.
snpe
.
imageclassifiers
.
detector
.
RetinaDetector
.
IMG_HEIGHT
;
import
static
com
.
qualcomm
.
qti
.
snpe
.
imageclassifiers
.
detector
.
RetinaDetector
.
IMG_WIDTH
;
...
...
@@ -18,6 +20,7 @@ import android.util.Log;
import
com.qualcomm.qti.snpe.imageclassifiers.MainActivity
;
import
com.qualcomm.qti.snpe.imageclassifiers.R
;
import
com.qualcomm.qti.snpe.imageclassifiers.detector.Bbox
;
import
com.qualcomm.qti.snpe.imageclassifiers.detector.MobilenetDetector
;
import
com.qualcomm.qti.snpe.imageclassifiers.detector.RetinaDetector
;
import
java.io.ByteArrayOutputStream
;
...
...
@@ -37,13 +40,13 @@ public class AiSlicingThread extends Thread{
/** class main attribute */
private
LinkedBlockingDeque
<
ImageSlice
>
aiSlicesQueue
;
private
Retina
Detector
mDetector
;
private
Mobilenet
Detector
mDetector
;
private
AISliceMergingThread
aiSliceMergingThread
;
private
boolean
isProcess
=
true
;
private
Context
mContext
;
/** Constructor 1: receive exist detector */
public
AiSlicingThread
(
Retina
Detector
mDetector
,
AISliceMergingThread
aiSliceMergingThread
)
{
public
AiSlicingThread
(
Mobilenet
Detector
mDetector
,
AISliceMergingThread
aiSliceMergingThread
)
{
this
.
aiSlicesQueue
=
new
LinkedBlockingDeque
<>();
this
.
aiSliceMergingThread
=
aiSliceMergingThread
;
this
.
mDetector
=
mDetector
;
...
...
@@ -55,7 +58,7 @@ public class AiSlicingThread extends Thread{
this
.
aiSlicesQueue
=
new
LinkedBlockingDeque
<>();
mContext
=
context
;
this
.
aiSlicesQueue
=
new
LinkedBlockingDeque
<
ImageSlice
>();
this
.
mDetector
=
new
RetinaDetector
(
context
,
application
,
R
.
raw
.
retina_mb_nosm_h288_w512_quantized
);
this
.
mDetector
=
new
MobilenetDetector
(
context
,
application
,
R
.
raw
.
mb1_ssd_sim
);
this
.
setName
(
AI_SLICING_THREAD
);
}
...
...
@@ -83,8 +86,8 @@ public class AiSlicingThread extends Thread{
sliceCropBox
.
getX
(),
sliceCropBox
.
getY
(),
sliceCropBox
.
getWidth
(),
sliceCropBox
.
getHeight
());
final
float
scaleX
=
IMG
_WIDTH
/
(
float
)
(
croppedBmp1
.
getWidth
());
final
float
scaleY
=
IMG
_HEIGHT
/
(
float
)
(
croppedBmp1
.
getHeight
());
final
float
scaleX
=
MODEL
_WIDTH
/
(
float
)
(
croppedBmp1
.
getWidth
());
final
float
scaleY
=
MODEL
_HEIGHT
/
(
float
)
(
croppedBmp1
.
getHeight
());
final
Matrix
scalingMatrix
=
new
Matrix
();
scalingMatrix
.
postScale
(
scaleX
,
scaleY
);
...
...
@@ -140,7 +143,7 @@ public class AiSlicingThread extends Thread{
return
aiSlicesQueue
.
offerLast
(
imageSlice
);
}
private
List
<
Bbox
>
startAIFlowDetect
(
Retina
Detector
mDetector
,
Bitmap
bmp
,
int
frameId
,
float
scaleX
,
float
scaleY
,
int
startX
,
int
startY
)
throws
IOException
{
private
List
<
Bbox
>
startAIFlowDetect
(
Mobilenet
Detector
mDetector
,
Bitmap
bmp
,
int
frameId
,
float
scaleX
,
float
scaleY
,
int
startX
,
int
startY
)
throws
IOException
{
List
<
Bbox
>
detectedBoxes
=
new
ArrayList
<>();
final
Bitmap
resizedBmpCopy
=
bmp
.
copy
(
Bitmap
.
Config
.
ARGB_8888
,
true
);
...
...
app/src/main/res/raw/mb1_ssd_sim.dlc
0 → 100644
View file @
ad02e95b
File added
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