Doubt about results.json file

Doubt about results.json file  

  By: vcasellesb on July 22, 2023, 10:31 a.m.

Hi! My algorithm is working ok, but during the execution of the script test.sh, there is a step I don't know what it does or how to perform it. It's the following:

docker run --rm \ -v toothfairy_algorithm-output-$VOLUME_SUFFIX:/output/ \ python:3.10-slim cat /output/results.json | python -m json.tool

This gives an error: cat: /output/results.json: No such file or directory Since there is no /output/results.json in the docker container. What is this file (results.json)? Should I generate it? What should it contain?

Thank you! Vicent Caselles

Re: Doubt about results.json file  

  By: llumetti on July 27, 2023, 8:38 a.m.

Hi Vincent, sorry for the late response. The results.json file is produced by evalutils when the algorithm ends. You can look at their GitHub repository for more details. This means that if you do not have a results.json file, probably something went wrong during the algorithm execution.

Best regards, Luca Lumetti

Re: Doubt about results.json file  

  By: vcasellesb on July 27, 2023, 11:10 a.m.

Hi,

Pardon me for my insistence, but I still don't undersand what this file should contain. Here I am pasting a snippet of the code in evalutils.py that I think is relevant to this discussion.

 def process_cases(self, file_loader_key: Optional[str] = None):
        if file_loader_key is None:
            file_loader_key = self._index_key
        self._case_results = []
        for idx, case in self._cases[file_loader_key].iterrows():
            self._case_results.append(self.process_case(idx=idx, case=case))

    @abstractmethod
    def process_case(self, *, idx: int, case: DataFrame) -> Dict:
        raise NotImplementedError()

    def save(self):
        with open(str(self._output_file), "w") as f:
            json.dump(self._case_results, f)

As you can see, the results.json files should contain what is dumped in the list case_results. However, the variable _case_results is filled with the function _process_case, which as you can see in the code it raises a NotImplementedError.

This leads me to the question: What should the process_case function return?

I hope I am making any sense. Thank you very much for your time.

Best regards, Vicent

 Last edited by: vcasellesb on Aug. 15, 2023, 12:58 p.m., edited 2 times in total.

Re: Doubt about results.json file  

  By: llumetti on July 27, 2023, 12:45 p.m.

process_case is implemented in the SegmentationAlgorithmclass, which inherits from Algorithm class. Please carefully look at the same file I've already linked to you. What is still missing is an implementation of the predict method, which must be implemented by yourself as producing an algorithm is the scope of this kind of challenge. We provided an example here of how to implement this kind of method.

 Last edited by: llumetti on Aug. 15, 2023, 12:58 p.m., edited 2 times in total.

Re: Doubt about results.json file  

  By: vcasellesb on July 27, 2023, 1:11 p.m.

Apologies Luca, I completely missed that part. Thank you very much for your time and support. Now I understand.

Best regards, Vicent Caselles