Ass222

June 15, 2017 | Autor: Harsh Vardhan | Categoria: Programming Languages, Image Processing
Share Embed


Descrição do Produto

LAB EXERCISE Intro One of the many outstanding problems in computer vision involves recognising the categories that features in images fall into. As was mentioned briefly during lectures, images of galaxies are one type of feature that is difficult to classify on the basis of shape, as you can see from the images below: the left one is an elliptical galaxy while the one on the right is a spiral (actually an anti-clockwise spiral).

One thing that you should be able to see from these images is that there are more blue-coloured stars in the spiral galaxy than in the elliptical one — this characteristic can be used as the basis of an algorithm to distinguish the two types.

A galaxy recognition program Your task is to write a program that reads in an image of a galaxy and identifies it as being elliptical or spiral; and if it is spiral, whether it is rotating clockwise or anticlockwise. You are free to use whatever algorithm you like as long as it processes the image data, for example you might consider using a histogram-based approach to distinguish elliptical galaxies from spiral ones.

You must implement the program in Python, and it must use the OpenCV library and no EVE routines. You are free to use any OpenCV routines you like in your program. Your program must be called galaxy. Also, your software must build and run under Linux. The executable version of your program must be called galaxy and it must be able to take the image to be classified on the command line; for example, to process the image galpic001.jpg it would be invoked as

The program must print on the standard output stream one of

Or

for clockwise spiral or

for anticlockwise spiral. There must be no other output. These restrictions are so that it works with the test harness described below.

Comparing and assessing algorithms The principles of evaluating a single algorithm and comparing the performances of several algorithms are described in the lecture notes. It is not especially difficult to perform this kind of thing by hand, though it is very tedious. For this reason, evaluations are usually performed using programs known as test harnesses. You will use a test harness and some image files to evaluate the performance of galaxy and compare its performance to my program, called agal. The particular test harness you will use is FACT ("Framework for Algorithm Comparison and Testing"), which was demonstrated in lectures. You need to download FACT and the relevant data files. FACT separates the stages of executing a program on a series of tests and analysing the results. This is because the execution stage is normally much slower than the analysis one and, as we shall

see, there are several analyses that one might like to perform. The execution stage produces a transcript file, and all the analysis stages use transcript files as input. You are actually going to perform two experiments: the first is to assess how well your program distinguishes elliptical galaxies from spiral, and the second is to assess how well it identifies the direction of rotation of spiral galaxies — the first of these is much easier than the second.

Elliptical or spiral The file galaxy1.fact contains the tests that are to be executed for this evaluation; it is human-readable and you are welcome to look at it. You should be able to run the test on galaxy using the command

The execute tells FACT to use the test script galaxy1.fact and output a transcript; you can use run rather than execute if you prefer. The command also tells FACT to use the "interface file" interface1.py to run your program: this is a Python routine (FACT is written in Python) that runs galaxy and fiddles with its output so that either CKW or ACW is registered as denoting a spiral galaxy. When you execute the above command, FACT will write output to your terminal window. The first line contains some identification information, used for checking in the analysis stages, followed by a single line per test. These lines are actually the transcript. To create a transcript file, you simply use command-line redirection to make these lines go to a file

and twiddle your thumbs while it runs. Having generated the transcript, the next stage is to analyze it, either in isolation or by comparing it with other algorithms. Analysing the transcript file is both quick and easy:

Rather than analyse, you can write analyze or anal. If the name of the file that you wish to analyse ends in .res, you can omit the .res. The results of the analysis are

written to your terminal window; you can use re-direction to save it in a file. You will see that the output contains two distinct tables, one summarising error rates etc. and the other a confusion matrix, which shows how false positives occur. You should interpret these in conjunction with the relevant chapter of the lecture notes. Your next step is to compare the performance of your program, galaxy, with that of agal. The transcript file from agal for the same tests is called agal1.res and is part of the zip-file that you downloaded above. You perform the comparison using the command:

You can get more detail by appending --detail=2 to the command. Again, you should interpret the results in conjunction with the lecture notes.

Finding the direction of rotation You can assess how well your program is at the complete problem, finding the direction of rotation as well as distinguishing galaxy type, using the command:

You can assess the performance of your program in isolation and by comparing it with agal2.res, the transcript from agal, in an analogous way to that for galaxy1.res. agal2.res is in the zip-file you downloaded.

Results Having assessed the performance of galaxy in isolation and compared it with that of agal for both stages of the assessment, you should summarize the results and interpret them in depth in the block of comments at the top of your program. I expect the results and interpretation to occupy a couple of pages of the print-out of your program, not just a few lines. Note that a good program must have a good coding quality, and the correct interpretation of the performance evaluation results.

Lihat lebih banyak...

Comentários

Copyright © 2017 DADOSPDF Inc.