Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
demo_bachelor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
gael.cartierm
demo_bachelor
Commits
3092299c
Commit
3092299c
authored
1 year ago
by
Gaël Cartier-Michaud
Browse files
Options
Downloads
Patches
Plain Diff
simplify harvest callback
parent
7f9895d1
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
config/config_detect_only.yaml
+23
-0
23 additions, 0 deletions
config/config_detect_only.yaml
config/config_laptop.yaml
+1
-1
1 addition, 1 deletion
config/config_laptop.yaml
demo/detector.py
+15
-15
15 additions, 15 deletions
demo/detector.py
with
39 additions
and
16 deletions
config/config_detect_only.yaml
0 → 100644
+
23
−
0
View file @
3092299c
# Configuration pour le laptop
detector
:
harvest
:
False
frame_before_exit
:
30
homography_path
:
'
./demo/homography_matrix.csv'
cam
:
dev_num
:
2
img_sz
:
[
1280
,
720
]
pix_format
:
'
GREY'
brightness
:
15
model
:
path
:
'
./demo/model/model_demo.pt'
img_sz
:
[
1280
,
1280
]
show
:
True
verbose
:
False
ip
:
detectorIP
:
'
192.168.125.42'
armIP
:
'
192.168.125.1'
port
:
50000
This diff is collapsed.
Click to expand it.
config/config_laptop.yaml
+
1
−
1
View file @
3092299c
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
detector
:
detector
:
harvest
:
True
harvest
:
True
frame_before_exit
:
30
frame_before_exit
:
25
homography_path
:
'
./demo/homography_matrix.csv'
homography_path
:
'
./demo/homography_matrix.csv'
cam
:
cam
:
...
...
This diff is collapsed.
Click to expand it.
demo/detector.py
+
15
−
15
View file @
3092299c
...
@@ -27,25 +27,25 @@ class Detector :
...
@@ -27,25 +27,25 @@ class Detector :
return
config
return
config
def
__harvestCallback
(
self
,
predictor
)
:
def
__harvestCallback
(
self
,
predictor
)
:
nothing
=
True
if
not
self
.
harvest_job
.
is_alive
()
:
classes
,
coordinates
=
predictor
.
results
[
0
].
boxes
.
cls
.
cpu
().
numpy
(),
predictor
.
results
[
0
].
cpu
().
boxes
.
xywh
.
numpy
()
nothing
=
True
for
cl
,
coord
in
zip
(
classes
,
coordinates
)
:
classes
,
coordin
ates
=
predictor
.
results
[
0
].
boxes
.
cls
.
cpu
().
numpy
(),
predictor
.
results
[
0
].
cpu
().
boxes
.
xywh
.
numpy
()
arm_coord
=
self
.
myArm
.
point_projection
(
(
coord
[
0
],
coord
[
1
])
)
for
cl
,
coord
in
zip
(
classes
,
coordinates
)
:
if
not
self
.
myArm
.
coordReachable
(
arm_coord
)
or
self
.
myModel
.
labelNum2Str
(
cl
)
==
'
hand
'
:
pass
arm_coord
=
self
.
myArm
.
point_projection
(
(
coord
[
0
],
coord
[
1
])
)
else
:
if
not
self
.
myArm
.
coordReachable
(
arm_coord
)
or
self
.
myModel
.
labelNum2Str
(
cl
)
==
'
hand
'
:
pass
nothing
=
Fa
lse
e
lse
:
if
not
self
.
harvest_job
.
is_alive
()
:
not
hing
=
False
print
(
"
\n
{} : x: {}, y: {}
"
.
format
(
self
.
myModel
.
labelNum2Str
(
cl
),
arm_coord
[
0
],
arm_coord
[
1
]
)
)
print
(
"
\n
{} : x: {}, y: {}
"
.
format
(
self
.
myModel
.
labelNum2Str
(
cl
),
arm_coord
[
0
],
arm_coord
[
1
]
)
)
self
.
myArm
.
target
=
(
arm_coord
[
0
],
arm_coord
[
1
],
cl
)
self
.
myArm
.
target
=
(
arm_coord
[
0
],
arm_coord
[
1
],
cl
)
self
.
startHarvestJob
()
self
.
startHarvestJob
()
break
break
if
nothing
:
self
.
nothing_counter
+=
1
if
nothing
:
self
.
nothing_counter
+=
1
if
self
.
isHarvestEnd
()
:
if
self
.
isHarvestEnd
()
:
if
not
self
.
harvest_job
.
is_alive
()
:
if
not
self
.
harvest_job
.
is_alive
()
:
print
(
"
\n
##### THE END #####
\n
"
)
print
(
"
\n
##### THE END #####
\n
"
)
self
.
myArm
.
target
=
(
0
,
0
,
self
.
myArm
.
end_value
)
self
.
myArm
.
target
=
(
0
,
0
,
self
.
myArm
.
end_value
)
self
.
startHarvestJob
()
self
.
startHarvestJob
()
self
.
exit_status
=
True
self
.
exit_status
=
True
def
startHarvestJob
(
self
)
:
def
startHarvestJob
(
self
)
:
self
.
harvest_job
=
Thread
(
target
=
self
.
myArm
.
harvest
,
args
=
(
self
.
myArm
.
target
,
)
)
self
.
harvest_job
=
Thread
(
target
=
self
.
myArm
.
harvest
,
args
=
(
self
.
myArm
.
target
,
)
)
...
...
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