Giter Site home page Giter Site logo

2022.infra.evalai-starters's People

Contributors

y2sman avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

2022.infra.evalai-starters's Issues

[평가서버 패키지 리스트]

현재 서버에 설치된 패키지는 아래와 같습니다.

  • opencv-python
  • opencv-contrib-python
  • pandas
  • scikit-learn
  • Pillow
  • cffi
  • service_identity
  • cython
  • numpy
  • scikit-image
  • matplotlib
  • pycocotools
  • pycocoevalcap
  • torch
  • Polygon3
  • bottle

평가코드 작성시, 필요한 패키지가 있다면 이슈에 남겨주시면 확인 후 추가하겠습니다. 가급적이면 패키지 공식 문서 URL과 함께 부탁드립니다.

[오류] 채점시 흔하게 발생하는 오류 (ChallengePhaseSplit matching query dose not exist)

설명

챌린지를 생성하시고, 채점을 시도 했을 때 오류가 발생하는 경우가 있습니다. 오류는 위 그림처럼 제출한 파일의 Result file / Stdout File / Stderr file 등의 링크에서 다운받아서 확인할 수 있습니다.

image

위 이미지의 오류는 challenge_config.yaml의 dataset_splits의 codename과 evaluation_script/main.py의 output에서 이름이 다를 경우 흔하게 발생합니다. 해당 부분을 확인하시고 챌린지 생성을 해주시면 되겠습니다.

[informative] 리더보드에 스코어 띄워보기

다른 것에서는 괜찮았는데 이 부분에서 json을 안해봤어서 그런지 애로사항이 있었습니다.

  1. evalutation_script\main.py로 이동하여, challenge_config.yaml에 입력했던 정답 파일의 경로를 바탕으로 평가 코드를 작성합니다.

이 부분에서 도움되시라고 MNIST 예제로 변형시켜서 올려봅니다.
한 번 리더보드에 점수 띄워보시고 본인의 테스크에 맞게 구상하셔서 바꿔서 코딩하시면 될 것 같습니다.

해당 사항에 도움을 준 @socome @big-chan 에게 감사의 말씀을 : )

MNIST 구성할 시 예제 설계

  • 분류기를 거친 예상된 10개 테스트셋에 대한 숫자 답으로 json에 기록된다. (submission.json).
  • 답변은 이와 같은 10개에 대한 숫자 답으로 json에 기록되어 있어야 한다. (test.json)
  • main.py 에서 10개의 답에 대한 예측의 정확도를 계산해서 return시킨다. (leaderboard 에 나올 점수)
  • challenge_config.yaml 의 해당 부분의 변수가 main.py 안에 들어가니 일치시켜줘야하는 부분은 일치시켜줘야한다. ( ex) pred_avg, codename, test_annotation_file )

main.py 와 일치시켜야하는 부분의 challenge_config.yaml

# --- #
# 리더보드의 평가 메트릭 관한 부분 #
# 평가 매트릭 이름을 여기서 입력합니다. #
# 평가는 evalutaion_script/main.py에서 작성한 코드로 하고, 리더보드 자체는 맨 아래에서 만듭니다. #
leaderboard:
  - id: 1
    schema:
      {
        "labels": ["pred_avg"],
        "default_order_by": "pred_avg",
        # --- #
        # 리더보드에 설명을 붙이고싶으면 아래와 같이 가능합니다. #
        # 오름차순 내림차순 설정과, 간단한 설명을 리더보드 페이지에 추가할 수 있습니다. #
        "metadata": {
          "pred_avg": {
            "sort_ascending": True,
            "description": "Recall@1 is defined as the ratio of correctly retrieved queries
within the top 1 predictions to the total number of queries ",
          }
        }
        # --- #
      }

    test_annotation_file: annotations/test.json
    codename: dev
    allowed_submission_file_types: ".json"

dataset_splits:
  - id: 1
    name: Test Split
    codename: test_split


# --- #

mnist에 해당하는 evaluation_script/main.py

import random
import json
import numpy as np

def evaluate(test_annotation_file, user_submission_file, phase_codename, **kwargs):
    print("Starting Evaluation.....")
    # --- #
    # test_annotation_file == challenge_config.yaml에서 설정한 정답 파일 #
    # user_submission_file == 유저가 사이트에서 업로드할 파일 #
    # phase_codename = challenge_config에서 설정하였음
    # --- #

    # --- #
    # 아래 output에 결과를 입력하고 return하면 사이트내 리더보드에 올라갑니다. #
    # output의 양식은 본인이 challenge_config.yaml에서 설정한 dataset_splits과 leaderboard(평가 메트릭)에 맞추시면 됩니다. #
    output = {}

    if phase_codename == "dev":
        # --- #
        # "dataset_splits" : { leaderboard's labels : 000 } #
        # 와 같은 형태로 입력해야합니다. #
        # challenge_config.yaml의 이름과 동일한지 꼭 확인해주세요 # 
        print("MNIST Evaluation...")
        answer_path = test_annotation_file
        test_path = user_submission_file

        with open(answer_path, "r") as gt_path:
            ground_truth = json.load(gt_path)
        with open(test_path, "r") as pred_path:
            predictions = json.load(pred_path)

        correct = 0.0
        for idx in range(len(ground_truth["mnist"])):
            pred = predictions["mnist"][idx]["pred"]
            gt = ground_truth['mnist'][idx]['pred']
            if pred == gt:
                correct += 1
            else:
                pass

        avg = correct / len(ground_truth["mnist"])

        output["result"] = [
            {
                "test_split": {
                    "pred_avg": avg
                }
            }
        ]
        # --- #
        # To display the results in the result file
        output["submission_result"] = output["result"][0]["test_split"]
        print("Completed evaluation")

    return output

test.json (정답)

{
	"mnist": [
		{
			"id" : 0, "pred" : 0
		},
		{
			"id" : 1, "pred" : 1 
		},
		{
			"id" : 2, "pred" : 2
		},
		{
			"id" : 3, "pred" : 3 
		},
		{
			"id" : 4, "pred" : 4
		},
		{
			"id" : 5, "pred" : 5 
		},
		{
			"id" : 6, "pred" : 6 
		},
		{
			"id" : 7, "pred" : 7 
		},
		{
			"id" : 8, "pred" : 8 
		},
		{
			"id": 9, "pred": 9
		}
	]
}

Submission.json (baseline)

{
	"mnist": [
		{
			"id" : 0, "pred" : 0
		},
		{
			"id" : 1, "pred" : 1 
		},
		{
			"id" : 2, "pred" : 2
		},
		{
			"id" : 3, "pred" : 3 
		},
		{
			"id" : 4, "pred" : 4
		},
		{
			"id" : 5, "pred" : 5 
		},
		{
			"id" : 6, "pred" : 6 
		},
		{
			"id" : 7, "pred" : 7 
		},
		{
			"id" : 8, "pred" : 8 
		},
		{
			"id" : 9, "pred" : 8 
		}
		
	]
}

zip. 파일 업로드 후의 과정

  • ComputerVision-Slack 에 가셔서 reboot 를 외칩니다.
  • 본인 리더보드 Sumbit에 가셔서 Submission.json을 제출해봅니다.
  • my submissions / all submissions 에 가면 다음의 내용을 확인할 수 있습니다. 잘못되었다면 baseline 에 N/A 혹은 Stderr file에 누룰 수 있는 버튼과 함께 누르시면 오류 내용이 뜰겁니다. (주로 main.py의 문법 오류 json 파일 불일치 문제)
  • Show on leaderboard, baseline에 정상적으로 네모박스가 있는데 누르시면, Leaderboard에 본인이 설정한 baseline 점수를 볼 수 있습니다.

my submissions / all submissions 정상 제출 화면

캡처

main.py 평가코드에 의해 연산된 스코어가 leaderboard에 올라간 모습

145235235

[Window에서 Challenge 파일 생성하기]

├── evaluation_script.zip                       # Contains the evaluation scripts
├── challenge_config.yaml                       # Configuration file to define challenge setup
├── logo.jpg                                    # Logo image of the challenge
├── submission.json                             # Sample submission file
├── run.sh                                      # Script to create the challenge configuration zip to be uploaded on EvalAI website
├── annotations                                 # Contains the annotations for Dataset splits
│   ├── test_annotations_devsplit.json          # Annotations of dev split
│   └── test_annotations_testsplit.json         # Annotations for test split
└── templates                                   # Contains challenge related HTML templates
    ├── challenge_phase_1_description.html      # Challenge Phase 1 description template
    ├── challenge_phase_2_description.html      # Challenge Phase 2 description template
    ├── description.html                        # Challenge description template
    ├── evaluation_details.html                 # Contains description about how submissions will be evalauted for each challenge phase
    ├── submission_guidelines.html              # Contains information about how to make submissions to the challenge
    └── terms_and_conditions.html               # Contains terms and conditions related to the challenge

윈도우에서는 run.sh가 제대로 실행되지 않습니다. 위의 파일 경로를 참고하셔서 직접 압축을 수행하시면 챌린지 파일을 만드실 수 있습니다. "evalutaion_script" 폴더만 따로 압축하신 후에 폴더에 있는 파일을 압축하시면 됩니다.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.