ArticleslgStudy

computer science

Contextual image classification

Contextual image classification is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Contextual image classification rather than just read about it. In short: Contextual image classification, a topic of pattern recognition in computer vision, is an approach of classification based on contextual information in images. "Contextual" means this approach is focusing on the relationship of the nearby pixels, which is also called neighbourhood. The goal of this approach is to classify the images by using the contextual information.

Contextual image classification — main illustration
Contextual image classification — illustration

Key takeaways

  • Contextual image classification belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Contextual image classification to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Contextual image classification from memory before moving on to harder problems.

Reference excerpt

Contextual image classification, a topic of pattern recognition in computer vision, is an approach of classification based on contextual information in images. "Contextual" means this approach is focusing on the relationship of the nearby pixels, which is also called neighbourhood. The goal of this approach is to classify the images by using the contextual information.

Introduction Similar as processing language, a single word may have multiple meanings unless the context is provided, and the patterns within the sentences are the only informative segments we care about. For images, the principle is same. Find out the patterns and associate proper meanings to them. As the image illustrated below, if only a small portion of the image is shown, it is very difficult to tell what the image is about.

Even try another portion of the image, it is still difficult to classify the image.

However, if we increase the contextual of the image, then it makes more sense to recognize.

As the full images shows below, almost everyone can classify it easily.

During the procedure of segmentation, the methods which do not use the contextual information are sensitive to noise and variations, thus the result of segmentation will contain a great deal of misclassified regions, and often these regions are small (e.g., one pixel). Compared to other techniques, this approach is robust to noise and substantial variations for it takes the continuity of the segments into account. Several methods of this approach will be described below.

Applications

Functioning as a post-processing filter to a labelled image This approach is very effective against small regions caused by noise. And these small regions are usually formed by few pixels or one pixel. The most probable label is assigned to these regions. However, there is a drawback of this method. The small regions also can be formed by correct regions rather than noise, and in this case the method is actually making the classification worse. This approach is widely used in remote sensing applications.

Improving the post-processing classification This is a two-stage classification process:

For each pixel, label the pixel and form a new feature vector for it. Use the new feature vector and combine the contextual information to assign the final label to the

Merging the pixels in earlier stages Instead of using single pixels, the neighbour pixels can be merged into homogeneous regions benefiting from contextual information. And provide these regions to classifier.

Acquiring pixel feature from neighbourhood The original spectral data can be enriched by adding the contextual information carried by the neighbour pixels, or even replaced in some occasions. This kind of pre-processing methods are widely used in textured image recognition. The typical approaches include mean values, variances, texture description, etc.

Combining spectral and spatial information The classifier uses the grey level and pixel neighbourhood (contextual information) to assign labels to pixels. In such case the information is a combination of spectral and spatial information.

Powered by the Bayes minimum error classifier Contextual classification of image data is based on the Bayes minimum error classifier (also known as a naive Bayes classifier). Present the pixel:

A pixel is denoted as x0. The neighbourhood of each pixel x0 is a vector and denoted as N(x0). The values in the neighbourhood vector is denoted as f(xi). Each pixel is presented by the vector ξ=(f(x0),f(x1),…,f(xk)) xi∈N(x0);i=1,…,k The labels (classification) of pixels in the neighbourhood N(x0) are presented as a vector η=(θ0,θ1,…,θk) θi∈{ω0,ω1,…,ωk} ωs here denotes the assigned class. A vector presents the labels in the neighbourhood N(x0) without the pixel x0 η̂=(θ1,θ2,…,θk) The neighbourhood: Size of the neighbourhood. There is no limitation of the size, but it is considered to be relatively small for each pixel x0. A reasonable size of neighbourhood would be 3×3 of 4-connectivity or 8-connectivity (x0 is marked as red and placed in the centre).

The calculation: Apply the minimum error classification on a pixel x0, if the probability of a class ωr being presenting the pixel x0 is the highest among all, then assign ωr as its class.

θ0=ωr if P(ωr∣f(x0))=maxs=1,2,…,RP(ωs∣f(x0)) The contextual classification rule is described as below, it uses the feature vector x1 rather than x0.

θ0=ωr if P(ωr∣ξ)=maxs=1,2,…,RP(ωs∣ξ) Use the Bayes formula to calculate the posteriori probability P(ωs∣ξ)

P(ωs∣ξ)=p(ξ∣ωs)P(ωs)p(ξ) The number of vectors is the same as the number of pixels in the image. For the classifier uses a vector corresponding to each pixel xi, and the vector is generated from the pixel's neighbourhood. The basic steps of contextual image classification:

Calculate the feature vector ξ for each pixel. Calculate the parameters of probability distribution p(ξ∣ωs) and P(ωs) Calculate the posterior probabilities P(ωr∣ξ) and all labels θ0. Get the image classification result.

Algorithms

Template matching The template matching is a "brute force" implementation of this approach. The concept is first create a set of templates, and then look for small parts in the image match with a template. This method is computationally high and inefficient. It keeps an entire templates list during the whole process and the number of combinations is extremely high. For a m×n pixel image, there could be a maximum of 2m×n combinations, which leads to high computation. This method is a top down method and often called table look-up or dictionary look-up.

Lower-order Markov chain The Markov chain also can be applied in pattern recognition. The pixels in an image can be recognised as a set of random variables, then use the lower order Markov chain to find the relationship among the pixels. The image is treated as a virtual line, and the method uses conditional probability.

Hilbert space-filling curves The Hilbert curve runs in a unique pattern through the whole image, it traverses every pixel without visiting any of them twice and keeps a continuous curve. It is fast and efficient.

Markov meshes The lower-order Markov chain and Hilbert space-filling curves mentioned above are treating the image as a line structure. The Markov meshes however will take the two dimensional information into account.

Dependency tree The dependency tree is a method using tree dependency to approximate probability distributions.

References

… excerpt ends here. Continue reading the full article.

Illustrations

Contextual image classification: Left eye
Left eye
Contextual image classification: Increased field of smiling face
Increased field of smiling face
Contextual image classification: Full image
Full image
Contextual image classification illustration
Contextual image classification illustration

Worked examples

Example 1 — a first encounter with Contextual image classification

Start with the simplest possible case. Write down what Contextual image classification claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Contextual image classification before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Contextual image classification ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Contextual image classification

In research
Contextual image classification appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Contextual image classification in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Contextual image classification is common in secondary-school and first-year university syllabi. It links to neighbouring topics Applications of computer vision, Computer vision, Image processing, so understanding it makes those chapters shorter.
In everyday life
Look for Contextual image classification outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Contextual image classification” →

How to study Contextual image classification in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Contextual image classification means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Contextual image classification out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Contextual image classification in simple terms?

Contextual image classification, a topic of pattern recognition in computer vision, is an approach of classification based on contextual information in images. "Contextual" means this approach is focusing on the relationship of the nearby pixels, which is also called neighbourhood. The goal of this…

Why does Contextual image classification matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Contextual image classification?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Contextual image classification.

Tags

  • Applications of computer vision
  • Computer vision
  • Image processing

Keep exploring