Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assessment Requirements / Tasks There are two parts to the assessment: Part I: An image classification application based on k Nearest Neighbour algorithm (50%)

Assessment Requirements / Tasks There are two parts to the assessment: Part I: An image classification application based on k Nearest Neighbour algorithm (50%) Part II: Worksheets Portfolio (50%) Part I: An image classification application based on k Nearest Neighbour algorithm You are required to implement a GUI application to perform image classification based on k- Nearest Neighbour (kNN) algorithm for CIFAR-10 image dataset. Key requirements of the application and guidance on the kNN algorithm are given below. Req1: The GUI application should allow the users to select one (or more) input sources (.bin files) as training data. Training data: https://learn.cardiffmet.ac.uk/mod/folder/view.php?id=939464 The images are stored in binary format detailed below. The binary version contains the files data_batch_1.bin, data_batch_2.bin,..., and data_batch_5.bin. Each of these files is formatted as follows: In other words, the first byte is the label of the first image, which is a number in the range 0-9. The next 3072 bytes are the values of the pixels of the image. The first 1024 bytes are the red channel values, the next 1024 the green, and the final 1024 the blue. The values are stored in row-major order, so the first 32 bytes are the red channel values of the first row of the image. Each file contains 10000 such 3073-byte "rows" of images, although there is nothing delimiting the rows. Therefore, each file should be exactly 30730000 bytes long. There is another file, called batches.meta.txt. This is an ASCII file that maps numeric labels in the range 0-9 to meaningful class names. It is merely a list of the 10 class names, one per row. The class name on row i corresponds to numeric label i. Further details can be found in http://www.cs.toronto.edu/~kriz/cifar.html Req2: The GUI application should allow the users to select a single.png image of size 32x32 as a test image, or specify the folder containing the test images so that all test images can be tested. Test images of size 32x32 in .png format are contained in Moodle, the link is given below https://learn.cardiffmet.ac.uk/mod/folder/view.php?id=939465 Req3: The GUI should allow the users to specify the parameters for the of the algorithm such as "k" value (range 1 to 10). Req4: Once all inputs (training images/labels, test image, k value) users should be allowed to start the classification process. The progress of the process should be made visible to the user and user should be able to stop the classification process. Req5: Once the processing is finished: For a single image input: the result (correct label) along side the test image should be displayed to the user together with the confidence level. For multiple test images: The accuracy of the algorithm should be displayed for the corresponding 'k' value. Accuracy (%) = classifications images num num The test images are labelled in "i_xxxx.png" format where i [0-9] representing the correct class, and 'xxxx' is the image identifier. Therefore, the num_correct_classifications can be obtained by comparing the i value in the test image name with the prediction obtained from the KNN algorithm The pseudo code for a potential implementation of the k-NN algorithm is given below. train_dataset: [train_images, train_lables] # Structure holding training images and labels d_img # Variable that holds the test input image # Structure to hold distances and labels end distance_lbl_array # iterate through each element in the train_dataset structure for each elemente in train_dataset for each elemente in train_dataset t_img=train_dataset[e][0] t_lbl train_dataset[e][1] #eh training image #eth label for the corresponding image # compute the Euclidian distance between test image and current image N N Ed=g.-d.j [t j-0 1-0 # store the Euclidian distance and the label of the training image distance_lbl_array[e] := [distance, t_lbl] # Sort distance_lbl_array according to the distance sorted distance_lbl_array:= sort (distance_lbl_array) # extract elements for k closest labels. e.g., if k-10, get the first 10 elements in the sorted_distance_lbl_array. closest_k_label_array:= sorted_distance_lbl_array[:k] # Find the label class with maximum number of label counts Estimated_label :=max_label_count(closest_k_label_array) # Find the confidence as a ratio of selected label count to total number of closest elements Confidence : max_label_count(closest_k_label_array)/size(closest_k_label_array) Req6: A report should be created including a instructions and steps to build, and execute your programs. This should clearly specify if any 3rd party libraries such as javafx, Lombok are used in your project and if a specific java version is needed to execute and run your program. A graph explaining the performance of the KNN algorithm with changing 'k' values (1 - 10) should be included, with a small discussion of what you think about the algorithm's behaviour and suitability for classification tasks. The accuracy figures for this plot can be obtained from the equation given in Req5.

Step by Step Solution

3.40 Rating (159 Votes )

There are 3 Steps involved in it

Step: 1

code from sklearn import datasets from sklearnmodelsel... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Organic Chemistry

Authors: Paula Yurkanis Bruice

4th edition

131407481, 978-0131407480

More Books

Students also viewed these Programming questions

Question

Which compound is more likely to be carcinogenic? b. or

Answered: 1 week ago