Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Code Computer Vision
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PolySTAR
RoboMaster
Computer Vision
Code Computer Vision
Commits
acc57a9d
Commit
acc57a9d
authored
5 years ago
by
Mathieu Beligon
Browse files
Options
Downloads
Patches
Plain Diff
[robots] (demo trt) Add target sender to pipeline
parent
2b8cc5bd
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
robots-at-robots/research/demos/demo_pipeline_camera.py
+18
-13
18 additions, 13 deletions
robots-at-robots/research/demos/demo_pipeline_camera.py
with
18 additions
and
13 deletions
robots-at-robots/research/demos/demo_pipeline_camera.py
+
18
−
13
View file @
acc57a9d
...
...
@@ -4,6 +4,7 @@ from time import time
import
pycuda.autoinit
# This is needed for initializing CUDA driver
from
polystar.common.communication.file_descriptor_target_sender
import
FileDescriptorTargetSender
from
polystar.common.communication.print_target_sender
import
PrintTargetSender
from
polystar.common.constants
import
MODELS_DIR
from
polystar.common.frame_generators.camera_frame_generator
import
CameraFrameGenerator
from
polystar.common.models.camera
import
Camera
...
...
@@ -15,6 +16,7 @@ from polystar.common.pipeline.object_selectors.closest_object_selector import Cl
from
polystar.common.pipeline.objects_detectors.trt_model_object_detector
import
TRTModelObjectsDetector
from
polystar.common.pipeline.objects_validators.confidence_object_validator
import
ConfidenceObjectValidator
from
polystar.common.pipeline.objects_validators.type_object_validator
import
TypeObjectValidator
from
polystar.common.pipeline.pipeline
import
NoTargetFound
from
polystar.common.pipeline.target_factories.ratio_simple_target_factory
import
RatioSimpleTargetFactory
from
polystar.common.utils.tensorflow
import
patch_tf_v2
from
polystar.common.view.cv2_results_viewer
import
CV2ResultViewer
...
...
@@ -41,20 +43,23 @@ if __name__ == "__main__":
fps
=
0
with
CV2ResultViewer
(
"
TensorRT demo
"
)
as
viewer
:
for
image
in
CameraFrameGenerator
(
1_280
,
720
).
generate
():
for
image
in
CameraFrameGenerator
(
1_280
,
720
).
generate
():
viewer
.
new
(
image
)
previous_time
=
time
()
try
:
# inference
pipeline
.
predict_target
(
image
)
# inference
pipeline
.
predict_target
(
image
)
# display
fps
=
0.9
*
fps
+
0.1
/
(
time
()
-
previous_time
)
viewer
.
new
(
image
)
viewer
.
add_objects
(
pipeline
.
debug_info_
.
validated_objects
,
forced_color
=
(
0.6
,
0.6
,
0.6
))
viewer
.
add_object
(
pipeline
.
debug_info_
.
selected_object
)
viewer
.
add_text
(
f
"
FPS:
{
fps
:
.
1
f
}
"
,
10
,
10
,
(
0
,
0
,
0
))
viewer
.
display
()
# display
viewer
.
add_objects
(
pipeline
.
debug_info_
.
validated_objects
,
forced_color
=
(
0.6
,
0.6
,
0.6
))
viewer
.
add_object
(
pipeline
.
debug_info_
.
selected_object
)
if
viewer
.
finished
:
break
if
viewer
.
finished
:
break
except
NoTargetFound
:
pass
finally
:
fps
=
0.9
*
fps
+
0.1
/
(
time
()
-
previous_time
)
viewer
.
add_text
(
f
"
FPS:
{
fps
:
.
1
f
}
"
,
10
,
10
,
(
0
,
0
,
0
))
viewer
.
display
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment