-
I thought a question rather than an issue was more fitting for this. I am a little bit confused by the CLI commands. I have a model which I use to run inference on a directory of images. After running it I can get the new images which have the predictions visualized. Could you please explain how to get a .json file of these predictions so that I can run the coco_evaluate command afterwards? Edit: Basically I want to know the procedure of getting the results.json file. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 12 replies
-
@isspid thanks for bringing this up. This has been answered before: https://github.com/obss/sahi/issues/273#issuecomment-971402591 But I will briefly explain again 🚀
|
Beta Was this translation helpful? Give feedback.
-
I was aware of this code. The corrected json is the attached. I get the same -1 values. Did your corrected json have the same structure? |
Beta Was this translation helpful? Give feedback.
-
Your corrected json doesn't have any annotations as far as I can see. I think you need to edit the code in order for it to work for you. Please try this and let me know how it goes. from sahi.utils.coco import Coco
from sahi.utils.file import save_json
# init Coco objects by specifying coco dataset paths and image folder directories
coco = Coco.from_coco_dict_or_path("dataset.json")
# select window categories; and map them to id 0
desired_name2id = {
"shark": 0,
"skate": 1,
}
coco.update_categories(desired_name2id)
# export updated/filtered COCO dataset
save_json(coco.json, "updated_dataset.json") |
Beta Was this translation helpful? Give feedback.
@isspid thanks for bringing this up. This has been answered before: https://github.com/obss/sahi/issues/273#issuecomment-971402591
But I will briefly explain again 🚀
dataset.json
).sahi predict --source coco/image/folder --dataset_json_path coco_dataset.json + other arguments
will export aresults.json
.dataset.json
andresult.json
you runsahi coco evaluate --dataset_json_path dataset.json --result_json_path result.json
.eval.json
containing coco evaluation results will be exported.sahi coco analyse --dataset_json_path dataset.json --result_json_path…