Play with YOSO

ERRORS

Error 1 - scipy 1.12.0

Reading https://pypi.org/simple/scipy/ Downloading https://files.pythonhosted.org/packages/30/85/cdbf2c3c460fe5aae812917866392068a88d02f07de0fe31ce738734c477/scipy-1.12.0.tar.gz#sha256=4bf5abab8a36d20193c698b0f1fc282c1d083c94723902c447e5d2f1780936a3 Best match: scipy 1.12.0 Processing scipy-1.12.0.tar.gz error: Couldn't find a setup script in /tmp/easy_install-hgxhvb36/scipy-1.12.0.tar.gz

手动安装scipy 得到scipy 1.11.0

pip install scipy

Error 2 - AttributeError: module 'PIL.Image' has no attribute 'LINEAR'

`PIL.Image.LINEAR` no longer exists · Issue #5010 · facebookresearch/detectron2 · GitHub

python3 -m pip install -U 'git+https://github.com/facebookresearch/detectron2.git@ff53992b1985b63bd3262b5a36167098e3dada02'

Error 3 - ModuleNotFoundError: No module named 'timm'

pip install timm

Error 4 - ModuleNotFoundError: No module named 'cv2'

(不是,怎么yoso的setup都不检查cv2阿?)

pip install opencv-python

Error 4 - assert num_gpus_per_machine <= torch.cuda.device_count()
AssertionError

-- Process 3 terminated with the following error:
Traceback (most recent call last):
  File "/home/xin/anaconda3/envs/YOSO/lib/python3.8/site-packages/torch/multiprocessing/spawn.py", line 59, in _wrap
    fn(i, *args)
  File "/home/xin/anaconda3/envs/YOSO/lib/python3.8/site-packages/detectron2/engine/launch.py", line 99, in _distributed_worker
    assert num_gpus_per_machine <= torch.cuda.device_count()
AssertionError

github给的命令

python projects/YOSO/train_net.py --num-gpus 4 --config-file projects/YOSO/configs/coco/panoptic-segmentation/YOSO-R50.yaml --eval-only MODEL.WEIGHTS ./model_zoo/yoso_res50_coco.pth

用了4个GPU

Error 5 ./model_zoo/yoso_res50_coco.pth

路经应该是 ./detecttron2/model_zoo/.........

Error 6 FileNotFoundError: [Errno 2] No such file or directory: 'datasets/coco/annotations/panoptic_val2017.json'

Error 7 from projects.YOSO import YOSO

sys.path.append(os.getcwd())

Error 8 

[ERROR:0@3.705] global cap_ffmpeg_impl.hpp:3130 open Could not find encoder for codec_id=27, error: Encoder not found
[ERROR:0@3.705] global cap_ffmpeg_impl.hpp:3208 open VIDEOIO/FFMPEG: Failed to initialize VideoWriter
[ERROR:0@3.705] global cap.cpp:643 open VIDEOIO(CV_IMAGES): raised OpenCV exception:

OpenCV(4.9.0) /io/opencv/modules/videoio/src/cap_images.cpp:430: error: (-215:Assertion failed) !filename_pattern.empty() in function 'open'
 

阿,用mp4就会有这个error但是不影响使用。

command for test

python demo/demo.py --config-file projects/YOSO/configs/coco/panoptic-segmentation/YOSO-R50.yaml --input /myfolder/KITTI/data_odometry_gray/dataset/sequences/00/image_0/*.png --output results/ --overlap-threshold 0.1 --confidence-threshold 0.1 --opts MODEL.WEIGHTS detectron2/model_zoo/yoso_res50_coco.pth

python demo/demo.py --config-file projects/YOSO/configs/mapillary-vistas/panoptic-segmentation/YOSO-R50.yaml --input /myfolder/KITTI/data_odometry_gray/dataset/sequences/00/image_0/000000.png --output testmapillary.png --opts MODEL.WEIGHTS detectron2/model_zoo/yoso_res50_mapillary.pth

python demo/demo.py --config-file projects/YOSO/configs/cityscapes/panoptic-segmentation/YOSO-R50.yaml --input /myfolder/KITTI/data_odometry_gray/dataset/sequences/00/image_0/000000.png --output testcityscapes.png --opts MODEL.WEIGHTS detectron2/model_zoo/yoso_res50_cityscapes.pth

找GPT加了个功能存一下masks

def store_results(predictions, visualized_output, image_filename, output_folder):
    # Extract base name from the image file
    base_name = os.path.splitext(os.path.basename(image_filename))[0]

    # Construct the output directory if it doesn't exist
    os.makedirs(output_folder, exist_ok=True)

    # Save visualized output
    visualized_output_filename = os.path.join(output_folder, f"{base_name}-visual.png")
    visualized_output.save(visualized_output_filename)

    # Save masks and information about each segment
    segments_info = predictions["panoptic_seg"][1]
    for idx, segment_info in enumerate(segments_info):
        mask = (predictions["panoptic_seg"][0] == segment_info["id"]).cpu().numpy().astype(np.uint8) * 255
        mask_filename = os.path.join(output_folder, f"{base_name}-{str(idx+1).zfill(2)}.png")
        cv2.imwrite(mask_filename, mask)

    # Save information about segments to a text file
    txt_filename = os.path.join(output_folder, f"{base_name}.txt")
    with open(txt_filename, "w") as txt_file:
        for segment_info in segments_info:
            txt_file.write(
                f"id: {segment_info['id']}, isthing: {segment_info['isthing']}, category_id: {segment_info['category_id']}, area: {segment_info['area']}\n")

  • 5
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值