Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qbe
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
A
Anaïs Halftermeyer
queryByExample
qbe
Commits
b1ba5891
Commit
b1ba5891
authored
Aug 22, 2025
by
Elias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tool: counting the number of segments
parent
552825ec
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
0 deletions
+38
-0
README.md
README.md
+8
-0
count_nb_segments.py
count_nb_segments.py
+30
-0
No files found.
README.md
View file @
b1ba5891
...
...
@@ -79,3 +79,11 @@ python3 hierarchiqueAvecDerniereDistance.py \
--output_name_average
dendro_avg.png
\
--output_name_complete
dendro_complete.png
```
# Tools
### • Counting the number of segments
```
bash
python3 count_nb_segments.py /path/to/your/segments
```
count_nb_segments.py
0 → 100644
View file @
b1ba5891
import
argparse
import
numpy
as
np
from
pathlib
import
Path
def
main
(
args
):
dossier
=
Path
(
args
.
dossier
)
fichiers_segment
=
sorted
(
dossier
.
glob
(
"**/*_segmentfeature.npy"
))
if
not
fichiers_segment
:
print
(
"Erreur."
)
return
total_segments
=
0
for
fichier
in
fichiers_segment
:
try
:
seg_features
=
np
.
load
(
fichier
)
n_segments
=
seg_features
.
shape
[
0
]
total_segments
+=
n_segments
except
Exception
as
e
:
print
(
f
"Erreur."
)
print
(
f
"Nombre total de segments : {total_segments}"
)
if
__name__
==
"__main__"
:
parser
=
argparse
.
ArgumentParser
(
description
=
"Comptage des segments dans les fichiers segmentfeature.npy"
)
parser
.
add_argument
(
"dossier"
,
type
=
str
,
help
=
"Chemin vers le dossier contenant les fichiers .npy"
)
args
=
parser
.
parse_args
()
main
(
args
)
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