WisconsinAIVision / yolact_edge

The first competitive instance segmentation approach that runs on small edge devices at real-time speeds.
MIT License
1.26k stars 273 forks source link

How to get json output? #191

Open ChrisPan4427 opened 2 years ago

ChrisPan4427 commented 2 years ago

Hello, thank you for providing these useful code. I had trained a model which works very well. Now I'm trying to get the json files of output image but failed.

I run with python eval.py --trained_model=weights/yolact_edge_29_10000.pth --score_threshold=0.95 --top_k=10 --images=./test_input:./test_output --output_coco_json --use_tensorrt_safe_mode

And get follow message Config not specified. Parsed yolact_edge_config from the file name.

[05/23 01:48:12 yolact.eval]: Loading model... [05/23 01:48:16 yolact.eval]: Model loaded.

(Lots of input->output)

Traceback (most recent call last): File "/home/chris/workspace/yolact_edge/eval.py", line 1280, in evaluate(net, dataset) File "/home/chris/workspace/yolact_edge/eval.py", line 916, in evaluate evalimages(net, inp, out, detections=detections) File "/home/chris/workspace/yolact_edge/eval.py", line 637, in evalimages evalimage(net, path, out_path, detections=detections, image_id=str(i)) File "/home/chris/workspace/yolact_edge/eval.py", line 588, in evalimage frame = torch.from_numpy(cv2.imread(path)).cuda().float() TypeError: expected np.ndarray (got NoneType)

And then the images with mask will be created correctly in output folder, but I just can't find json files. I'm not sure if the issue is caused by these erro.

Environment:

Edit:

I got json files somehow, but I don't know how and I couldn't do that again. The mask file: [{"image_id": 0, "category_id": 2, "segmentation": {"size": [550, 550], "counts": "fQV44g1W1Y<]2]OP2QN;ZEYJW9k6000000001O2N2N1O2N4L2N1O2N3M3M1O1O5K2N1O2N3M2N2N2N3M3M1O2N3M2N2N2N3M3M1O2N3M3M1O2N4L2N2N2N3M2N2N2N3M3M2N2N3M3M1O3M3M3M2N2N3M3M1O3M3M3M1O2N3M3M1O2N4L2N2N2N3M2N2N2N4L2N2N2N3M2N2N2N3M3M2N2N3M2N2N2N4L2N2N5K`VX3"}, "score": 0.9979863166809082}

I'm wondering that is these are just random text or they can be transfered to segmentation text like following "segmentation": [ [ 200.562242, 535.291737, 324.392297, 533.413761, 254.183127, 217.639024, 248.224126, 217.285556, 200.562242, 535.291737 ]

ChrisPan4427 commented 2 years ago

I solved my first problem by deleting the json file from input folder. It seems like there should not be any json file in the input folder. But still, I want to know if there is any soluton to transfer the mask file.