faris-k / fastsiam-wafers Goto Github PK
View Code? Open in Web Editor NEWSelf-Supervised Representation Learning of Wafer Maps with FastSiam
License: MIT License
Self-Supervised Representation Learning of Wafer Maps with FastSiam
License: MIT License
Novel idea: learn a DPW-invariant representation of a failure shading by including a DPW transform. Consider the wafer in the middle. Could I transform it to the lower DPW variant (left) and higher DPW variant (right)?
Working method of going from right to left: take the central relative coordinate of each die and map it to a smaller matrix. Toy example with a matrix of just 1's and 2's would look something like this:
For wafer maps, simple implementation below:
def dpw_transform(original_matrix, scale):
# Calculate the new dimensions of the matrix after scaling down
h, w = original_matrix.shape
new_h = int(h * scale)
new_w = int(w * scale)
new_dim = (new_h, new_w)
# Find the indices of the passing elements in the original matrix
passing_indices = np.argwhere(original_matrix == 128)
# Find the indices of the failing elements in the original matrix
failing_indices = np.argwhere(original_matrix == 255)
# Calculate the relative central coordinate of the passing and failing elements in the original matrix
pass_coords = (passing_indices + 0.5) / original_matrix.shape
fail_coords = (failing_indices + 0.5) / original_matrix.shape
# Calculate the central coordinates of the passing and failing elements in the new matrix
new_pass_coords = (pass_coords * new_dim).astype(int)
new_fail_coords = (fail_coords * new_dim).astype(int)
# Create the (new_h, new_w) matrix
new_matrix = np.zeros(new_dim, dtype=int)
# Assign the passing and failing elements in the new matrix
new_matrix[new_pass_coords[:, 0], new_pass_coords[:, 1]] = 128
new_matrix[new_fail_coords[:, 0], new_fail_coords[:, 1]] = 255
return new_matrix
Example of a wafer resized by a scale of 0.75 (from shape (41, 33)
to (30, 24)
)
As expected, more yield loss on the wafer with higher die size / lower DPW.
The approach outlined above doesn't work from left to right in the Yield Model image (turn a wafer into a higher DPW version of itself) since taking the central die coordinates of the original wafer won't always map to every die on the higher DPW wafer map. Case in point:
How do we "sparsify" defects but still keep shadings like scratches and rings "connected" on the higher DPW part?...
Minor enhancement, but since speed is a concern with self-supervised pretraining, use Albumentations instead of torchvision and lightly's transforms. Throughput is reportedly much higher: https://github.com/albumentations-team/albumentations#benchmarking-results
Consistent crashes occur with any nonzero value of num_workers
on Windows systems. Multiprocessing on Linux doesn't seem to have this issue, but the added abstraction of WSL2 leads to low GPU utilization and thus lower throughput.
WaferMapDataset
needs to be looked at. Data is loaded from a Pandas dataframe, specifically two Pandas series of numpy arrays (more or less a ragged array structure). The wafer map Series is converted to a list of different-sized tensors. PyTorch's nested tensors may be a better data structure for this. These are experimental and may change with the upcoming PyTorch 2.0 release though.This repo was meant simply for a class project and FastSiam (hence the name). It has expanded far beyond its scope ๐
Currently, the benchmarking scripts are entirely self-contained, which is fine for running the benchmarks themselves, but this makes inference on trained models messy. To avoid spaghetti code ๐,
This will make training and feature extraction much more streamlined, i.e.
from models.knn import MAE
# Create a model and load a checkpoint
model = MAE()
ckpt_path = "bruh.ckpt"
model.load_state_dict(torch.load(ckpt_path)["state_dict"])
# Run inference (feature extraction)
trainer = pl.Trainer()
preds = trainer.predict(model, inference_dataloader)
preds = torch.cat(preds, dim=0)
Benchmarks were all run using knn_k=200
, the default value in KNNBenchmarkModule
. No wonder accuracy/F1 scores never went higher than 0.5-0.6
Tasks:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.