ClevrTex: A Texture-Rich Benchmark for Unsupervised Multi-Object Segmentation

Overview

ClevrTex

This repository contains dataset generation code for ClevrTex benchmark from paper: ClevrTex: A Texture-Rich Benchmark for Unsupervised Multi-Object Segmentation

Requirements

The follwing preparation steps are required to generate the dataset.

  1. Setting up blender
  2. Setting up python
  3. Setting up textures and materials

Blender

We used blender 2.92.3 for rendering. Newer versions are untested but should work at least up to a minor bump. One might download it from Blender website and follow installation instructions process as normal then skip to the final step. Or simply execute this (will set up blender in /usr/local/blender):

mkdir /usr/local/blender && \
curl -SL "http://mirror.cs.umn.edu/blender.org/release/Blender2.92/blender-2.92.0-linux64.tar.xz" -o blender.tar.xz && \
tar -xvf blender.tar.xz -C /usr/local/blender --strip-components=1 && \
rm blender.tar.xz && ln -s /usr/local/blender/blender /usr/local/bin/blender

Since we use "system interpreter" (see intructions bellow to set up a compatible one) for Blender headless mode, remove python that comes pre-packaged.

rm -rf /usr/local/blender/2.92/python

Python

One needs to set up python with required libraries and with correct version. Blender uses python 3.7 (older or newer version will not work). For simplicty, use conda:

conda env create -f env.yaml

When invoking Blender use (assumes the appropriate env was named p37) :

PYTHONPATH=~/miniconda3/envs/p37/bin/python \
PYTHONHOME=~/miniconda3/envs/p37 \
blender --background --python-use-system-env --python generate.py -- <args>

Textures

The final piece is to set up source assets for rendering, namely the materials. Briefly, the textures used to create the materials are copyrighted by Poliigon Pty Ltd. Textures used in the ClevrTex dataset are freely availble (at the time of writing) and should be downloaded from www.poliigon.com (download metalness workflow for matalics). Please check MATERIALS.md for full list.

Download appropriate textures and place them into data/materials/textures and data/outd_materials/textures. Note, the textures should be in the directory not in subfolders. We include .blend files for materials which have been stripped of the original textures (due to licensing restrictions) but contain the settings adjustments made. Skip the following instructions if working with existing .blend files.

To add new materials:

The following process needs to be applied for each new material. Consider using addon provided by Poliigon.

  1. Import materials textures as per addon's instructions.
  2. Open the material in question in node editor in Blender.
  3. Create a new node group of all nodes except the output node (yes this will nest the groups, it is intentional). We rely on the trick identified by Johnson et al. in the original CLEVR script where Blender seems to copy-by-value node trees, which makes it trivial to create duplicate materials in the scene.
  4. Connect any inputs of interest to the group inputs. Crucially, check that Scale and Displacement Strength are available as inputs. The sampling script will pass these in to ensure that background/objects have correct scale adjustements to ensure level of details does not disappear between small objects and large background. Check that outputs have been connected to Shader output nodes (should have happended automatically).
  5. Ensure that the materials look good with other parameters. Consider including additional logic nodes to e.g. scaling, and displacement parameters. Materials have Random \in [0, 1] number passed to them as input (if available), if one needs to randomise aspects of the material.
    • (Optional) Render the materials to see how they would look in the output. Repeat until desired look is acheived.
  6. Ensure the node group is named identically to the material and then save it as your-node-group-name.blend.

This is unfortunatelly a manual process to ensure all textures look good that usually involves several test render per texture.

Debugging textures

To ensure the textures are found and look good, consider trying with a single texture first (to save time). To scan for errors and see how the end result might look like, consider using --test_scan option in the generation script.* In addition, consider --blendfiles option to save blender scene after rendering for manual inspection.

Generating

To generate the dataset run the following (will produce a LOCAL_debug_000001.png example):

cd clevrtex-gen
 ./local_test.bash

Otherwise, please see arguments available to customise the rendering. Dataset variants can be recreated using appropriate .json files.

Using ClevrTex

See project page for download links for CLEVRTEX. clevrtex_eval.py file contains dataloading logic to for convenient access to CLEVRTEX data. Consider

from clevrtex_eval import CLEVRTEX, collate_fn

clevrtex = CLEVRTEX(
    'path-to-downloaded-data', # Untar'ed
    dataset_variant='full', # 'full' for main CLEVRTEX, 'outd' for OOD, 'pbg','vbg','grassbg','camo' for variants.
    split='train',
    crop=True,
    resize=(128, 128),
    return_metadata=True # Useful only for evaluation, wastes time on I/O otherwise 
)
# Use collate_fn to handle metadata batching
dataloader = torch.utils.data.DataLoader(clevrtex, batch_size=BATCH, shuffle=True, collate_fn=collate_fn)

Evaluation

See CLEVRTEX_Evaluator in clevrtex_eval.py. It implements all the utilities needed.

CLEVR

This dataset builds upon CLEVR: A Diagnostic Dataset for Compositional Language and Elementary Visual Reasoning
Justin Johnson, Bharath Hariharan, Laurens van der Maaten, Fei-Fei Li, Larry Zitnick, Ross Girshick
presented at CVPR 2017, code available at https://github.com/facebookresearch/clevr-dataset-gen

In particular we use a method for computing cardinal directions from CLEVR. See the original licence included in the clevr_qa.py file.

BibTeX

If you use ClevrTex dataset or generation code consider citing:

BiBTeX coming soon...
You might also like...
Object Detection and Multi-Object Tracking
Object Detection and Multi-Object Tracking

Object Detection and Multi-Object Tracking

SiamMOT is a region-based Siamese Multi-Object Tracking network that detects and associates object instances simultaneously.
TSDF++: A Multi-Object Formulation for Dynamic Object Tracking and Reconstruction

TSDF++: A Multi-Object Formulation for Dynamic Object Tracking and Reconstruction TSDF++ is a novel multi-object TSDF formulation that can encode mult

TorchDistiller - a collection of the open source pytorch code for knowledge distillation, especially for the perception tasks, including semantic segmentation, depth estimation, object detection and instance segmentation.

This project is a collection of the open source pytorch code for knowledge distillation, especially for the perception tasks, including semantic segmentation, depth estimation, object detection and instance segmentation.

 Robust Instance Segmentation through Reasoning about Multi-Object Occlusion [CVPR 2021]
Robust Instance Segmentation through Reasoning about Multi-Object Occlusion [CVPR 2021]

Robust Instance Segmentation through Reasoning about Multi-Object Occlusion [CVPR 2021] Abstract Analyzing complex scenes with DNN is a challenging ta

Multi-Object Tracking in Satellite Videos with Graph-Based Multi-Task Modeling
Multi-Object Tracking in Satellite Videos with Graph-Based Multi-Task Modeling

TGraM Multi-Object Tracking in Satellite Videos with Graph-Based Multi-Task Modeling, Qibin He, Xian Sun, Zhiyuan Yan, Beibei Li, Kun Fu Abstract Rece

Multi-atlas segmentation (MAS) is a promising framework for medical image segmentation
Multi-atlas segmentation (MAS) is a promising framework for medical image segmentation

Multi-atlas segmentation (MAS) is a promising framework for medical image segmentation. Generally, MAS methods register multiple atlases, i.e., medical images with corresponding labels, to a target image;

Deep Multi-Magnification Network for multi-class tissue segmentation of whole slide images
Deep Multi-Magnification Network for multi-class tissue segmentation of whole slide images

Deep Multi-Magnification Network This repository provides training and inference codes for Deep Multi-Magnification Network published here. Deep Multi

HistoSeg : Quick attention with multi-loss function for multi-structure segmentation in digital histology images

HistoSeg : Quick attention with multi-loss function for multi-structure segmentation in digital histology images Histological Image Segmentation This

Comments
  • Purple Textures

    Purple Textures

    Hi I am faced with lost materials issue when reproducing,

    I run ./local_test.bash and find that the image is purple after rendering, which indicates sth is wrong with materials. But it shows

    Set Sphere_0 to poliigonmetalspottydiscoloration001 from data/materials/PoliigonMetalSpottyDiscoloration001.blend
    

    so I think the materials have been rightly loaded. Any advice for me?

    LOCAL_debug_000000

    opened by WeixiongLin 3
  • Top-right corner not filled.

    Top-right corner not filled.

    Hello and thanks for the repo. When changing the size of images from 320x240 to 128x128 or 256x256 in local_test.bash (I didn't make any other modifications to the code) some images appear with the top-right corner not filled (cf. attached example). I don't see this problem with images of size 320x240. Do you have any idea what might be causing this ? Thank you. LOCAL_debug_000003

    opened by perladoubinsky 2
  • Mismatch between Texture .blend filename and the material associated to it

    Mismatch between Texture .blend filename and the material associated to it

    Dear Authors,

    Great work on CLEVRTex! Wanted to bring up a minor naming issue that the blend file PoliigonFabricUpholsteryBrightAnglePattern001.blend actually contains the material FabricUpholsteryMidCenturyPebbles001 and not PoliigonFabricUpholsteryBrightAnglePattern001. The same fix may also be needed in the MATERIALS.md file.

    Thanks! Gautam.

    opened by singhgautam 0
An implementation of "Optimal Textures: Fast and Robust Texture Synthesis and Style Transfer through Optimal Transport"

Optex An implementation of Optimal Textures: Fast and Robust Texture Synthesis and Style Transfer through Optimal Transport for TU Delft CS4240. You c

Hans Brouwer 33 Jan 5, 2023
"3D Human Texture Estimation from a Single Image with Transformers", ICCV 2021

Texformer: 3D Human Texture Estimation from a Single Image with Transformers This is the official implementation of "3D Human Texture Estimation from

XiangyuXu 193 Dec 5, 2022
[ICCV'2021] Image Inpainting via Conditional Texture and Structure Dual Generation

[ICCV'2021] Image Inpainting via Conditional Texture and Structure Dual Generation

Xiefan Guo 122 Dec 11, 2022
Unsupervised Semantic Segmentation by Contrasting Object Mask Proposals.

Unsupervised Semantic Segmentation by Contrasting Object Mask Proposals This repo contains the Pytorch implementation of our paper: Unsupervised Seman

Wouter Van Gansbeke 335 Dec 28, 2022
Segmentation in Style: Unsupervised Semantic Image Segmentation with Stylegan and CLIP

Segmentation in Style: Unsupervised Semantic Image Segmentation with Stylegan and CLIP Abstract: We introduce a method that allows to automatically se

Daniil Pakhomov 134 Dec 19, 2022
The Unsupervised Reinforcement Learning Benchmark (URLB)

The Unsupervised Reinforcement Learning Benchmark (URLB) URLB provides a set of leading algorithms for unsupervised reinforcement learning where agent

null 259 Dec 26, 2022
pytorch implementation of "Contrastive Multiview Coding", "Momentum Contrast for Unsupervised Visual Representation Learning", and "Unsupervised Feature Learning via Non-Parametric Instance-level Discrimination"

Unofficial implementation: MoCo: Momentum Contrast for Unsupervised Visual Representation Learning (Paper) InsDis: Unsupervised Feature Learning via N

Zhiqiang Shen 16 Nov 4, 2020
Tools to create pixel-wise object masks, bounding box labels (2D and 3D) and 3D object model (PLY triangle mesh) for object sequences filmed with an RGB-D camera.

Tools to create pixel-wise object masks, bounding box labels (2D and 3D) and 3D object model (PLY triangle mesh) for object sequences filmed with an RGB-D camera. This project prepares training and testing data for various deep learning projects such as 6D object pose estimation projects singleshotpose, as well as object detection and instance segmentation projects.

null 305 Dec 16, 2022
Official PyTorch implementation of Joint Object Detection and Multi-Object Tracking with Graph Neural Networks

This is the official PyTorch implementation of our paper: "Joint Object Detection and Multi-Object Tracking with Graph Neural Networks". Our project website and video demos are here.

Richard Wang 443 Dec 6, 2022