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
be3ec5ae
Commit
be3ec5ae
authored
4 years ago
by
Mathieu Beligon
Browse files
Options
Downloads
Patches
Plain Diff
[common] (LabelMap) Move to parent folder and simplify usage
parent
6bfede69
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/polystar/common/constants.py
+1
-1
1 addition, 1 deletion
common/polystar/common/constants.py
common/polystar/common/models/label_map.py
+6
-2
6 additions, 2 deletions
common/polystar/common/models/label_map.py
with
7 additions
and
3 deletions
common/polystar/common/constants.py
+
1
−
1
View file @
be3ec5ae
...
...
@@ -4,4 +4,4 @@ PROJECT_DIR: Path = Path(__file__).parent.parent.parent.parent
RESOURCES_DIR
:
Path
=
PROJECT_DIR
/
"
resources
"
MODELS_DIR
:
Path
=
RESOURCES_DIR
/
"
models
"
LABEL_MAP_PATH
:
Path
=
PROJECT_DIR
/
"
dataset
"
/
"
tf_records
"
/
"
label_map.pbtxt
"
LABEL_MAP_PATH
:
Path
=
PROJECT_DIR
/
"
dataset
"
/
"
label_map.pbtxt
"
This diff is collapsed.
Click to expand it.
common/polystar/common/models/label_map.py
+
6
−
2
View file @
be3ec5ae
import
re
from
dataclasses
import
dataclass
from
pathlib
import
Path
from
typing
import
Dict
,
Any
,
List
from
typing
import
Any
,
Dict
,
List
from
dataclasses
import
dataclass
from
polystar.common.constants
import
LABEL_MAP_PATH
@dataclass
...
...
@@ -30,3 +31,6 @@ class LabelMap:
name2id
=
{
n
:
int
(
i
)
for
i
,
n
in
d
.
items
()}
id2name
=
d
return
LabelMap
(
id2name
=
id2name
,
name2id
=
name2id
)
label_map
=
LabelMap
.
from_file
(
LABEL_MAP_PATH
)
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