jamesjg / FoodSAM

FoodSAM: Any Food Segmentation
Apache License 2.0
134 stars 13 forks source link

pred_mask_path is not correct. #10

Open jyp-studio opened 4 months ago

jyp-studio commented 4 months ago

While I faced the problem when using the command metioned in your demo step.

python FoodSAM/semantic.py --img_path <path/to/img> --output <path/to/output>

However, I got this error message:

Traceback (most recent call last):
  File "FoodSAM/semantic.py", line 322, in <module>
    main(args)
  File "FoodSAM/semantic.py", line 309, in main
    enhance_masks(args.output, args.category_txt, args.color_list_path, num_class=args.num_class, area_thr=args.area_thr, ratio_thr=args.ratio_thr, top_k=args.top_k)
  File "/DATA/jyp/FoodSAM/FoodSAM/FoodSAM_tools/enhance_semantic_masks.py", line 100, in enhance_masks
    pred_mask = cv2.imread(pred_mask_path)[:,:,2]
TypeError: 'NoneType' object is not subscriptable

It seems that the code cannot find the correct path to the corresponding mask generated by the model. Please tell me how to solve this problem.

Additionally, can the output of a food image to be a corresponding mask but not a file within plenty of files such as input.jpg, mask folders, and metadata.

Thanks!