One-shot recognition of any material anywhere using contrastive learning with physics-based rendering

Manuel S. Drehwald, Sagi Eppel, Jolina Li, Han Hao, Alan Aspuru-Guzik

TL;DR

This paper introduces MatSim, a novel synthetic dataset and real-world benchmark designed for one-shot material recognition. By training a Siamese network on procedurally generated material mixtures and transitions, the model learns to identify fine-grained material states (such as raw vs. cooked food or rusted vs. shiny metal) under any environmental condition, significantly outperforming massive foundation models like CLIP.

What Problem Does This Paper Address?

While modern computer vision models excel at recognizing broad semantic categories (e.g., distinguishing wood from plastic), they struggle to identify fine-grained material states and transitions. Knowing whether a surface is wet or dry, whether metal is rusted, or if food is safely cooked is critical for applications ranging from robotics and autonomous labs to agriculture and cooking.

The core challenges are twofold:

  1. Infinite Variability: Material states change gradually and continuously, making discrete categorization difficult.
  2. Environmental Distortions: In real-world settings like kitchens or chemistry labs, materials are frequently observed inside transparent containers, which warp and distort their visual appearance.

Prior approaches have been restricted to the specific classes they were trained on. This paper tackles the challenge of one-shot material recognition: identifying any unfamiliar material or material state in any environment using only a single reference image.

Methods

The authors employ a self-similarity contrastive learning strategy. Instead of relying on expensive human-annotated semantic labels, they train a neural network to recognize the same material texture when applied to entirely different 3D objects, backgrounds, and lighting conditions.

Key methodological highlights include:

  • Architecture Modifications: They utilize a ConvNeXt-base backbone, modifying the input layer to accept a 4-channel tensor (RGB + Region of Interest mask). This forces the network to focus specifically on the material region rather than the surrounding object or environment.
  • Continuous Similarity Loss: Traditional triplet loss uses binary positive/negative pairs. Because material transitions are continuous, the authors introduce a semi-hard loss function that scales based on the exact linear mixing ratio ($R$) of two materials.
  • Procedural Vessel Generation: To train the network to see through glass, they procedurally generate transparent containers by combining random polynomial and trigonometric functions into 3D surfaces, filling them with random material meshes.
Figure 6. Procedurally generating material inside transparent con- tainers. a) A random 2D curve is generated by combining random polynomial and trigonometric functions. b) The curve is used as a profile for the symmetric 3D object. c,d) The object is assigned random transparent materials and content objects. e) The content object is assigned a material.

Datasets

The paper introduces the MatSim ecosystem, which consists of a massive synthetic training set and two real-world benchmarks:

  1. MatSim Synthetic Dataset: Contains roughly 1 million images across 30,000 sets. Each set features a gradual transition between two random materials across six different scenes with varying objects (from ShapeNet) and environmental lighting (from PolyHaven HDRIs).
  2. Set 1 (Material Transition States and Subclasses): A real-world benchmark consisting of 416 images across 116 material types, capturing fine-grained states like raw, cooked, and burned eggs, or wet and dry sidewalks.
  3. Set 2 (Uncorrelated Materials and Objects): An adversarial real-world benchmark of 86 images across 16 material types. To completely decouple object geometry from material texture, the authors manually wrapped random objects in unrelated materials (e.g., covering an item in granular fibers).

The models were also evaluated on existing standard material classification datasets: OpenSurface, Dense Material Segmentation (DMS), and Flicker Materials Database (FMD).

Figure 1. The MatSim benchmark for identifying materials from every aspect of the world using one or a few real images (one shot). Top-1 results of ConvNeXt trained on the synthetic Mat- Sim dataset and Clip H14. Neither of the networks was trained with these classes. Only selected samples are shown.

Key Insights and Ideas

  • Variability Over Realism: A key philosophy in generating the MatSim dataset was prioritizing scene diversity over perfect physical realism. Generating surreal images—like a car made of wood sitting on a metal floor in a forest—prevented the network from learning false correlations between specific objects and materials.
  • The Power of Targeted Synthetic Data: Despite being trained purely on simulated data, the MatSim network generalized remarkably well to the real world. It consistently outperformed Open CLIP H14, a model trained on 2 billion real-world image-text pairs, proving that targeted synthetic data can beat massive web-scale pre-training for specialized visual tasks.

Key Results

The MatSim-trained network demonstrated superior performance across both fine-grained state recognition and adversarial benchmarks:

  • Fine-Grained States (Set 1 Subclass): MatSim achieved a Top-1 accuracy of 0.71 (improving to 0.78 when utilizing background masking), compared to Open CLIP H14's best score of 0.67 (with cropping).
  • Adversarial Objects (Set 2): On the uncorrelated object benchmark, MatSim with masking achieved an accuracy of 0.91, significantly outperforming Open CLIP H14's 0.77.
  • General Material Classification: On broader datasets like OpenSurface and DMS, the MatSim model outperformed CLIP without ever using semantic text labels (scoring 0.33 vs 0.32 on OpenSurface, and 0.29 vs 0.14 on DMS). CLIP maintained an edge only on the small-scale FMD dataset (0.82 vs 0.66), where semantic context provides a major advantage.

Limitations and Future Work

The primary limitation acknowledged by the authors involves the simulation of phase transitions. Currently, MatSim models transitions as simple linear pixel-wise mixtures of two texture maps. In reality, material transitions are often non-linear or non-uniform—such as the appearance of fire during the transition from wood to coal, or the crystalline nucleation of ice in water. Future work will need to integrate more complex physical rendering techniques to capture these non-uniform state changes.

Summary updated

BibTeX
@inproceedings{drehwald2022one,
  author = {Manuel S. Drehwald and Sagi Eppel and Jolina Li and Han Hao and Alan Aspuru-Guzik},
  title = {{One-shot recognition of any material anywhere using contrastive learning with physics-based rendering}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2022},
}
Figure