vedant gala
vedant gala

Reputation: 428

Building a network to detect cracks in a CT Scan

This problem statement is an extension of this problem asked: Detecting the presence of a black areas in a grayscale image

I am providing the entire problem at hand and therefore thought to include it in a separate post.

Machines are now able to 3-D print metal parts. They do so in layers - and after the addition of each layer, a scan is taken in grayscale. The following images are taken at layer 2 and layer 75 respectively. These images are exactly how they should be looking.

However, If lets say there is a crack in the scan at layer 75, then the scan shows it as a dark line/curve (not jet black, but definitely darker than the surrounding grey areas)

The objective is to detect this crack at every layer, so that further printing can be stopped immediately.

Can this be done using a neural network? Since it is much more preferred to develop code that is generic - the same code can be used for the scans of some other part.

I am not really asking for the entire code, just the best possible approach towards the solution.

This is layer 2: Layer 2

This is layer 75: Layer 75

Upvotes: 1

Views: 334

Answers (1)

Stephen Meschke
Stephen Meschke

Reputation: 2940

Yes, a neural network is a possible solution to crack detection in your 3d printed part. After each layer is printed, an image of the partially printed part would be passed to a neural network. The neural network would classify the image as 'no cracks' or 'crack present.'

Sample data is required to train the neural network. Do you have any images of 3d printed parts with cracks in them? Hopefully not! If you know what cracks usually look like, you could create a dataset of synthetic data and train the neural network using that. Here is an example of a crack that I generated using Python/OpenCV: generated crack using python This is the code that I used to generate the crack:

import cv2, numpy as np, random
# Read source image
img = cv2.imread('/home/stephen/Desktop/lco7q.jpg')
# Create dx and dy arrays (this defines the crack
crack_length = 41
dy = np.random.normal(0,1,crack_length)+1
dx = np.random.normal(0,1,crack_length)+1
# Start the crack at 'a'
a = 0,123
# Iterate through each point in the crack
for i in range(crack_length-1):
    # Calculate which way the crack is going
    b = a[0] + dx[i] *i, a[1] + dy[i] *i
    # Draw a line
    cv2.line(img, tuple(np.array(a, int)), tuple(np.array(b, int)), 0, 4)
    # Go onto the next point
    a = b
# Show the image
cv2.imshow('img', img)
cv2.waitKey(0)
cv2.destroyAllWindows()

Upvotes: 1

Related Questions