minor adjustments
This commit is contained in:
parent
98d3b3ff2f
commit
367be396a7
@ -7,6 +7,8 @@ The program uses Random Forest Classifier to recognize five types of rubbish:
|
||||
* metal
|
||||
* paper
|
||||
* plastic
|
||||
|
||||
|
||||
Before running the program it is obligatory to unpack "Garbage classifier.rar" and "ClassificationGarbage.rar".
|
||||
## Extracting information from images
|
||||
In order to use Random Forest Classifier to classify pictures, I used three global feature descriptors:
|
||||
@ -38,14 +40,14 @@ def haralick(image):
|
||||
```
|
||||
allFeatures = np.hstack([histo, hara, huMoments])
|
||||
```
|
||||
##Creating test and training sets
|
||||
## Creating test and training sets
|
||||
Data is divided between two sets, where training set contains 80% of all data and test set only 20%. Images are randomly shuffled.
|
||||
```
|
||||
allFileNames = os.listdir(sourceDir)
|
||||
np.random.shuffle(allFileNames)
|
||||
trainingFileNames, testFileNames = np.split(np.array(allFileNames), [int(len(allFileNames) * (1 - testRatio))])
|
||||
```
|
||||
##Implementation
|
||||
## Implementation
|
||||
Functions in garbageDumpSorting.py:
|
||||
* createSets - divides images between test and training set. This function should be run only once, unless the folders with training and test set are removed,
|
||||
```
|
||||
@ -66,10 +68,10 @@ prediction = clf.predict(features)[0]
|
||||
```
|
||||
* sortDump - checks what kinds of trash are inside the garbage truck and their quantity, empties the garbage truck and sorts its contents on the garbage dump.
|
||||
|
||||
##Changes in common part
|
||||
## Changes in common part
|
||||
I created class garbageDump in which I store information about the quantity of trash present on the garbage dump. I had to add a small function to Garbagetruck class in order to remove wastes from the garbage truck. In main I initialize garbage dump and at the end I display its contents.
|
||||
|
||||
##Libraries
|
||||
## Libraries
|
||||
The following libraries are required to run the program:
|
||||
```
|
||||
import os
|
||||
|
Loading…
Reference in New Issue
Block a user