【587】安装 labelme

  目前在做计算机视觉,需要自己打标,被安利 labelme,但是目前此网站以及不支持注册了,只能本地安装来实现。可以按照网站说明一步步操作。

  • 按照 https://github.com/wkentaro/labelme 操作完成的

  • 不同操作系统按照不同的方式安装,本文是 MacOS

  • 需要安装 Anaconda、Docker,前者比较容易,后者也还好

  • 下载 Docker Desktop,按照基本流程处理即可,然后运行下面代码,在 Terminal 里面运行即可

  • # on macOS
    socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:"$DISPLAY" &
    docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=docker.for.mac.host.internal:0 -v $(pwd):/root/workdir wkentaro/labelme
  • 然后安装 pyqt,用来实现图形界面效果的,可以参考:mac install PyQt5,通过以下实现

  • # brew 实现挺乱的
    pip3 install sip
    pip3 install pyqt5
  • 最后在安装 labelme 即可,如下所示:

  • pip install labelme
    

  使用方法:

  • Run labelme --help for detail.

  • The annotations are saved as a JSON file.

  • 直接定位到图片所在文件夹,然后通过下面代码即可打开窗体操作

  • labelme  # just open gui
    
    # tutorial (single image example)
    cd examples/tutorial
    labelme apc2016_obj3.jpg  # specify image file
    labelme apc2016_obj3.jpg -O apc2016_obj3.json  # close window after the save
    labelme apc2016_obj3.jpg --nodata  # not include image data but relative image path in JSON file
    labelme apc2016_obj3.jpg 
      --labels highland_6539_self_stick_notes,mead_index_cards,kong_air_dog_squeakair_tennis_ball  # specify label list
    
    # semantic segmentation example
    cd examples/semantic_segmentation
    labelme data_annotated/  # Open directory to annotate all images in it
    labelme data_annotated/ --labels labels.txt  # specify label list with a file
    

  其他相关链接及操作见 GitHub 链接。

原文地址:https://www.cnblogs.com/alex-bn-lee/p/14962053.html