Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
engine_file_creation_and_counting
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
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sikhin.vc
engine_file_creation_and_counting
Commits
2ae86e48
Commit
2ae86e48
authored
Jun 05, 2023
by
Sikhin VC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initial commit
parent
a0413783
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
edge_engine/model_optimizer.py
edge_engine/model_optimizer.py
+6
-6
No files found.
edge_engine/model_optimizer.py
View file @
2ae86e48
...
@@ -14,7 +14,7 @@ class ModelOptimization:
...
@@ -14,7 +14,7 @@ class ModelOptimization:
logger
.
info
(
f
"Provided number of classes and image size are : {self.num_class} and {self.image_size}"
)
logger
.
info
(
f
"Provided number of classes and image size are : {self.num_class} and {self.image_size}"
)
try
:
try
:
with
open
(
'yolov5/yololayer.h'
,
'r'
)
as
file
:
with
open
(
'
/app/edge_engine/
yolov5/yololayer.h'
,
'r'
)
as
file
:
# read a list of lines into data
# read a list of lines into data
data
=
file
.
readlines
()
data
=
file
.
readlines
()
...
@@ -23,7 +23,7 @@ class ModelOptimization:
...
@@ -23,7 +23,7 @@ class ModelOptimization:
data
[
21
]
=
f
" static constexpr int INPUT_W = {self.image_size};
\n
"
data
[
21
]
=
f
" static constexpr int INPUT_W = {self.image_size};
\n
"
# and write everything back
# and write everything back
with
open
(
'yolov5/yololayer.h'
,
'w'
)
as
file
:
with
open
(
'
/app/edge_engine/
yolov5/yololayer.h'
,
'w'
)
as
file
:
file
.
writelines
(
data
)
file
.
writelines
(
data
)
logger
.
info
(
"Successfully changed configurations"
)
logger
.
info
(
"Successfully changed configurations"
)
except
Exception
as
e
:
except
Exception
as
e
:
...
@@ -37,16 +37,16 @@ class ModelOptimization:
...
@@ -37,16 +37,16 @@ class ModelOptimization:
logger
.
info
(
f
"Current directory is : {current_directory}"
)
logger
.
info
(
f
"Current directory is : {current_directory}"
)
build_path
=
os
.
path
.
join
(
current_directory
,
"yolov5"
,
"build"
)
build_path
=
os
.
path
.
join
(
current_directory
,
"yolov5"
,
"build"
)
if
os
.
path
.
isdir
(
'yolov5/build'
):
if
os
.
path
.
isdir
(
'
/app/edge_engine/
yolov5/build'
):
logger
.
info
(
"build directory exists. Removing build directory!!"
)
logger
.
info
(
"build directory exists. Removing build directory!!"
)
shutil
.
rmtree
(
'yolov5/build'
)
shutil
.
rmtree
(
'
/app/edge_engine/
yolov5/build'
)
os
.
mkdir
(
build_path
)
os
.
mkdir
(
build_path
)
weight_name_with_extension
=
os
.
path
.
basename
(
self
.
weight_path
)
weight_name_with_extension
=
os
.
path
.
basename
(
self
.
weight_path
)
weight_name
,
extension
=
os
.
path
.
splitext
(
weight_name_with_extension
)
weight_name
,
extension
=
os
.
path
.
splitext
(
weight_name_with_extension
)
src
=
f
"{current_directory}/yolov5/build/
"
src
=
"/app/edge_engine/yolov5/build
"
shutil
.
copy
(
self
.
weight_path
,
src
)
shutil
.
copy
(
self
.
weight_path
,
src
)
logger
.
info
(
f
"Created build folder"
)
logger
.
info
(
f
"Created build folder"
)
os
.
chdir
(
'yolov5/build'
)
os
.
chdir
(
'
/app/edge_engine/
yolov5/build'
)
logger
.
info
(
"Running CMake command"
)
logger
.
info
(
"Running CMake command"
)
subprocess
.
run
([
'cmake'
,
'..'
])
subprocess
.
run
([
'cmake'
,
'..'
])
logger
.
info
(
"Running Make command"
)
logger
.
info
(
"Running Make command"
)
...
...
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