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
7142c14a
Commit
7142c14a
authored
Jun 06, 2023
by
Sikhin VC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
abc
parent
d557f8f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
15 deletions
+17
-15
edge_engine/model_optimizer.py
edge_engine/model_optimizer.py
+17
-15
No files found.
edge_engine/model_optimizer.py
View file @
7142c14a
...
...
@@ -36,27 +36,29 @@ class ModelOptimization:
current_directory
=
os
.
getcwd
()
logger
.
info
(
f
"Current directory is : {current_directory}"
)
build_path
=
os
.
path
.
join
(
"/app/edge_engine"
,
"yolov5"
,
"build"
)
if
os
.
path
.
isdir
(
'/app/edge_engine/yolov5/build'
):
logger
.
info
(
"build directory exists. Removing build directory!!"
)
shutil
.
rmtree
(
'/app/edge_engine/yolov5/build'
)
os
.
mkdir
(
build_path
)
weight_name_with_extension
=
os
.
path
.
basename
(
self
.
weight_path
)
weight_name
,
extension
=
os
.
path
.
splitext
(
weight_name_with_extension
)
src
=
"/app/edge_engine/yolov5/build"
shutil
.
copy
(
self
.
weight_path
,
src
)
logger
.
info
(
f
"Created build folder"
)
#
build_path = os.path.join("/app/edge_engine", "yolov5", "build")
#
if os.path.isdir('/app/edge_engine/yolov5/build'):
#
logger.info("build directory exists. Removing build directory!!")
#
shutil.rmtree('/app/edge_engine/yolov5/build')
#
os.mkdir(build_path)
#
weight_name_with_extension = os.path.basename(self.weight_path)
#
weight_name, extension = os.path.splitext(weight_name_with_extension)
#
src = "/app/edge_engine/yolov5/build"
#
shutil.copy(self.weight_path, src)
#
logger.info(f"Created build folder")
os
.
chdir
(
'/app/edge_engine/yolov5/build'
)
logger
.
info
(
"Running CMake command"
)
subprocess
.
run
([
'cmake'
,
'..'
])
logger
.
info
(
"Running Make command"
)
subprocess
.
run
([
'make'
])
logger
.
info
(
"Optimizing model"
)
engine_name
=
weight_name
+
".engine"
subprocess
.
run
([
"sudo"
,
"./yolov5"
,
"-s"
,
weight_name_with_extension
,
engine_name
,
"c"
,
"0.33"
,
"0.50"
])
engine_file_path
=
os
.
path
.
join
(
src
,
engine_name
)
shutil
.
copy
(
engine_file_path
,
"/app/data/"
)
# engine_name = weight_name + ".engine"
engine_name
=
"best.engine"
# subprocess.run(["sudo", "./yolov5", "-s", weight_name_with_extension, engine_name, "c", "0.33", "0.50"])
subprocess
.
run
([
"sudo"
,
"./yolov5"
,
"-s"
,
"best.wts"
,
"best.engine"
,
"c"
,
"0.33"
,
"0.50"
])
# engine_file_path = os.path.join(src, engine_name)
#
# shutil.copy(engine_file_path, "/app/data/")
except
Exception
as
e
:
logger
.
info
(
f
"Failed to optimized model : {e}"
)
...
...
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