Skip to content

4d Places365

Hou Yujun edited this page Sep 17, 2024 · 2 revisions

Inference

The script classifies the type of scene or place depicted in each image, among over 400 place categories, utilising a VGG-16 model pretrained on the Places365 dataset.

Input

The input CSV should:

  • have each row representing an image to process, and
  • contain minimally two columns, named uuid and path, to specify image UUID and the local image file path, respectively

Output

One CSV that contains two columns: uuids and the inferred place category.

To reproduce sample_output

Modify run_scene_multiple.py:

  1. Modify out_Folder: Insert the local ABSOLUTE PATH to the docker/sample_output folder
  2. Modify in_Folder: Insert the local ABSOLUTE PATH to the docker/input_csvs folder
  3. Modify in_imgFolder: Insert the local ABSOLUTE PATH to the docker/input_imgs folder

Make sure you cd into the docker/ directory

Build the docker image:

docker build -t places365_image .

Run the following command after modifying the relevant paths as instructed:

docker run --rm --name places365_container --mount type=bind,source=insert-the-local-ABSOLUTE-PATH-to-the-code/download_imgs/sample_output/all-folder,target=insert-the-local-ABSOLUTE-PATH-to-the-docker/input_csvs-folder --mount type=bind,source=insert-the-local-ABSOLUTE-PATH-to-the-code/download_imgs/sample_output/all/1_50-folder,target=insert-the-local-ABSOLUTE-PATH-to-the-docker/input_imgs-folder --mount type=bind,source=insert-the-local-ABSOLUTE-PATH-to-the-docker/sample_output-folder,target=insert-the-local-ABSOLUTE-PATH-to-the-docker/sample_output-folder places365_image python run_scene_multiple.py; docker image rm places365_image

To run inference for other images

Modify run_scene_multiple.py:

  1. Modify input_filename to the filename of your input csv including the .csv extension, e.g. input.csv
  2. Modify out_Folder: Insert the local ABSOLUTE PATH to the docker/sample_output folder
  3. Modify in_Folder: Insert the local ABSOLUTE PATH to the docker/input_csvs folder
  4. Modify in_imgFolder: Insert the local ABSOLUTE PATH to the docker/input_imgs folder

Make sure you cd into the docker/ directory

Build the docker image:

docker build -t places365_image .

Run the following command after modifying the relevant paths as instructed:

docker run --rm --name places365_container --mount type=bind,source=insert-the-local-ABSOLUTE-PATH-to-your-own-folder-that-contains-your-input-CSVs,target=insert-the-local-ABSOLUTE-PATH-to-the-docker/input_csvs-folder --mount type=bind,source=insert-the-local-ABSOLUTE-PATH-to-your-own-folder-that-contains-your-input-images,target=insert-the-local-ABSOLUTE-PATH-to-the-docker/input_imgs-folder --mount type=bind,source=insert-the-local-ABSOLUTE-PATH-to-your-own-output-folder,target=insert-the-local-ABSOLUTE-PATH-to-the-docker/sample_output-folder places365_image python run_scene_multiple.py; docker image rm places365_image

Acknowledgements

This part of our repo is modified from the original repo on Places365 by Zhou et al. (2017).