Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yolo_model_optimization
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
yolo_model_optimization
Commits
f04b8b6b
You need to sign in or sign up before continuing.
Commit
f04b8b6b
authored
Jun 09, 2023
by
Sikhin VC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
api changes
parent
184f194c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
yolo_optimization.py
yolo_optimization.py
+9
-9
No files found.
yolo_optimization.py
View file @
f04b8b6b
...
...
@@ -36,14 +36,14 @@ class ModelOptimization:
logger
.
info
(
f
"Failed to change configurations : {e}"
)
def
optimize_model
(
self
):
try
:
c
urrent_directory
=
os
.
getcwd
()
logger
.
info
(
f
"Current directory is : {c
urrent
_directory}"
)
if
os
.
path
.
exists
(
os
.
path
.
join
(
c
urrent
_directory
,
'tensorrtx/yolov5/build'
)):
shutil
.
rmtree
(
os
.
path
.
join
(
c
urrent
_directory
,
'tensorrtx/yolov5/build'
))
c
ode_directory
=
"/opt/yolo_model_optimization"
logger
.
info
(
f
"Current directory is : {c
ode
_directory}"
)
if
os
.
path
.
exists
(
os
.
path
.
join
(
c
ode
_directory
,
'tensorrtx/yolov5/build'
)):
shutil
.
rmtree
(
os
.
path
.
join
(
c
ode
_directory
,
'tensorrtx/yolov5/build'
))
logger
.
info
(
"Removed existing build directory"
)
os
.
mkdir
(
os
.
path
.
join
(
c
urrent
_directory
,
'tensorrtx/yolov5/build'
))
os
.
mkdir
(
os
.
path
.
join
(
c
ode
_directory
,
'tensorrtx/yolov5/build'
))
logger
.
info
(
"Built new build directory"
)
shutil
.
copy
(
self
.
weight_path
,
os
.
path
.
join
(
c
urrent
_directory
,
'tensorrtx/yolov5/build'
))
shutil
.
copy
(
self
.
weight_path
,
os
.
path
.
join
(
c
ode
_directory
,
'tensorrtx/yolov5/build'
))
logger
.
info
(
"Copied wts file to build directory"
)
weight_name_with_extension
=
os
.
path
.
basename
(
self
.
weight_path
)
os
.
chdir
(
'tensorrtx/yolov5/build'
)
...
...
@@ -54,9 +54,9 @@ class ModelOptimization:
subprocess
.
run
([
'make'
])
logger
.
info
(
"Optimizing model"
)
engine_name
=
"best.engine"
subprocess
.
run
([
"sudo"
,
"./yolov5"
,
"-s"
,
os
.
path
.
join
(
c
urrent
_directory
,
'tensorrtx/yolov5/build'
,
weight_name_with_extension
)
,
engine_name
,
"c"
,
"0.33"
,
"0.50"
])
shutil
.
move
(
os
.
path
.
join
(
c
urrent
_directory
,
'tensorrtx/yolov5/build'
,
engine_name
),
self
.
mount_path
)
shutil
.
move
(
os
.
path
.
join
(
c
urrent
_directory
,
'tensorrtx/yolov5/build'
,
"libmyplugins.so"
),
self
.
mount_path
)
subprocess
.
run
([
"sudo"
,
"./yolov5"
,
"-s"
,
os
.
path
.
join
(
c
ode
_directory
,
'tensorrtx/yolov5/build'
,
weight_name_with_extension
)
,
engine_name
,
"c"
,
"0.33"
,
"0.50"
])
shutil
.
move
(
os
.
path
.
join
(
c
ode
_directory
,
'tensorrtx/yolov5/build'
,
engine_name
),
self
.
mount_path
)
shutil
.
move
(
os
.
path
.
join
(
c
ode
_directory
,
'tensorrtx/yolov5/build'
,
"libmyplugins.so"
),
self
.
mount_path
)
logger
.
info
(
f
"Moved engine file and libmyplugins.so file to {self.mount_path}"
)
except
Exception
as
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