Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
template_challenge
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
Container 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
Helmholtz Data Challenges
Challenges
template_challenge
Commits
7e48c0dd
Commit
7e48c0dd
authored
4 years ago
by
Mehdi Cherti
Browse files
Options
Downloads
Patches
Plain Diff
add evaluation_script
parent
b5413f40
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
evaluation_script/__init__.py
+1
-0
1 addition, 0 deletions
evaluation_script/__init__.py
evaluation_script/main.py
+68
-0
68 additions, 0 deletions
evaluation_script/main.py
with
69 additions
and
0 deletions
evaluation_script/__init__.py
0 → 100644
+
1
−
0
View file @
7e48c0dd
from
.main
import
evaluate
This diff is collapsed.
Click to expand it.
evaluation_script/main.py
0 → 100644
+
68
−
0
View file @
7e48c0dd
import
random
import
numpy
as
np
import
pandas
as
pd
from
sklearn.metrics
import
accuracy_score
def
evaluate
(
test_annotation_file
,
user_submission_file
,
phase_codename
,
**
kwargs
):
print
(
"
Starting Evaluation.....
"
)
"""
Evaluates the submission for a particular challenge phase and returns score
Arguments:
`test_annotations_file`: Path to test_annotation_file on the server
`user_submission_file`: Path to file submitted by the user
`phase_codename`: Phase to which submission is made
`**kwargs`: keyword arguments that contains additional submission
metadata that challenge hosts can use to send slack notification.
You can access the submission metadata
with kwargs[
'
submission_metadata
'
]
Example: A sample submission metadata can be accessed like this:
>>>
print
(
kwargs
[
'
submission_metadata
'
])
{
'
status
'
:
u
'
running
'
,
'
when_made_public
'
:
None
,
'
participant_team
'
:
5
,
'
input_file
'
:
'
https://abc.xyz/path/to/submission/file.json
'
,
'
execution_time
'
:
u
'
123
'
,
'
publication_url
'
:
u
'
ABC
'
,
'
challenge_phase
'
:
1
,
'
created_by
'
:
u
'
ABC
'
,
'
stdout_file
'
:
'
https://abc.xyz/path/to/stdout/file.json
'
,
'
method_name
'
:
u
'
Test
'
,
'
stderr_file
'
:
'
https://abc.xyz/path/to/stderr/file.json
'
,
'
participant_team_name
'
:
u
'
Test Team
'
,
'
project_url
'
:
u
'
http://foo.bar
'
,
'
method_description
'
:
u
'
ABC
'
,
'
is_public
'
:
False
,
'
submission_result_file
'
:
'
https://abc.xyz/path/result/file.json
'
,
'
id
'
:
123
,
'
submitted_at
'
:
u
'
2017-03-20T19:22:03.880652Z
'
}
"""
output
=
{}
target
=
read_annotation
(
test_annotation_file
)
pred
=
read_annotation
(
user_submission_file
)
split
=
phase_codename
print
(
f
"
Evaluating for
{
phase_codename
}
Phase
"
)
output
[
"
result
"
]
=
[
{
split
:
{
# Please add your metrics here
"
accuracy
"
:
accuracy_score
(
target
,
pred
),
}
}
]
# To display the results in the result file
output
[
"
submission_result
"
]
=
output
[
"
result
"
][
0
][
split
]
print
(
f
"
Completed evaluation for
{
phase_codename
}
Phase
"
)
return
output
def
read_annotation
(
path
):
df
=
pd
.
read_csv
(
path
)
output_cols
=
[
"
image
"
,
"
label
"
]
assert
set
(
output_cols
).
issubset
(
set
(
df
.
columns
))
df
=
df
[
output_cols
]
return
df
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