Skip to content

Latest commit

 

History

History
78 lines (63 loc) · 3.06 KB

installation.md

File metadata and controls

78 lines (63 loc) · 3.06 KB

Installation

We have tested the code with python==3.7 and pytorch=1.8, other late versions may also work well.
Welcome to provide feedback or suggestion for the version list!

Install FoodSAM with the following steps:

a. Clone the repository locally:

git clone https://github.com/jamesjg/FoodSAM.git

b. Create a conda virtual environment and activate it

conda create -n FoodSAM python=3.7 -y
conda activate FoodSAM

c. Install PyTorch and torchvision following the official instructions. Here we use PyTorch 1.8.1 and CUDA 11.1. You may also switch to another version by specifying the version number.

pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html

d. Install MMCV following the official instructions.

pip install mmcv-full==1.3.0 -f https://download.openmmlab.com/mmcv/dist/cu110/torch1.8.0/index.html

e. Install SAM following official SAM installation.

pip install git+https://github.com/facebookresearch/segment-anything.git@6fdee8f

f. other requirements

pip install -r requirement.txt

e. Finally download three checkpoints, and move them to "ckpts/" folder as described.

SAM-vit-h

FoodSeg103-SETR-MLA

UNIDET-Unified_learned_OCIM_RS200_6x+2x

If the above links are not working, you also can download them in Baidu Disk (code:pyyk).

Dataset and configs

For UNIDET and FoodSeg103, the configs are already put into the configs folder. You can also download other ckpt and configs from their official links.

The default dataset we use is FoodSeg103, other semantic segmentation food datasets like UECFOODPIXCOMPLETE can also be used. But you should change the args.category_txt and args.num_class. The dataset should be put in the "dataset/"folder.

Your data, configs, and ckpt path should look like this:

FoodSAM
-- ckpts
   |-- SETR_MLA
   |   |-- iter_80000.pth
   |-- sam_vit_h_4b8939.pth
   |-- Unified_learned_OCIM_RS200_6x+2x.pth
-- configs
   |-- Base-CRCNN-COCO.yaml
   |-- Unified_learned_OCIM_RS200_6x+2x.yaml
   |-- SETR_MLA_768x768_80k_base.py
-- dataset
   |-- FoodSeg103
   |   |-- Images
   |   |   |-- ann_dir
   |   |   |-- img_dir  
-- FoodSAM
-- mmseg
-- UNIDET
   ...