touch up
This commit is contained in:
parent
cd70306d93
commit
2eb83a3d02
@ -57,21 +57,29 @@ trainingFileNames, testFileNames = np.split(np.array(allFileNames), [int(len(all
|
|||||||
## Implementation
|
## Implementation
|
||||||
Functions in garbageDumpSorting.py:
|
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,
|
* 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,
|
||||||
|
|
||||||
```
|
```
|
||||||
trainingFileNames, testFileNames = np.split(np.array(allFileNames), [int(len(allFileNames) * (1 - testRatio))])
|
trainingFileNames, testFileNames = np.split(np.array(allFileNames), [int(len(allFileNames) * (1 - testRatio))])
|
||||||
```
|
```
|
||||||
|
|
||||||
* huMoments, haralick, histogram - calculate global feature descriptors,
|
* huMoments, haralick, histogram - calculate global feature descriptors,
|
||||||
* processTrainData, processTestData - both work in the same way, they iterate over files in train or test directory, saves features as a matrix and then saves results to h5 file, it is recommended to run it only once as it takes some time to finish.
|
* processTrainData, processTestData - both work in the same way, they iterate over files in train or test directory, saves features as a matrix and then saves results to h5 file, it is recommended to run it only once as it takes some time to finish.
|
||||||
|
|
||||||
```
|
```
|
||||||
allFeatures = np.hstack([histo, hara, huMoments])
|
allFeatures = np.hstack([histo, hara, huMoments])
|
||||||
|
|
||||||
```
|
```
|
||||||
* trainAndTest - creates classifier, trains it and scores it,
|
* trainAndTest - creates classifier, trains it and scores it,
|
||||||
|
|
||||||
```
|
```
|
||||||
clf = RandomForestClassifier(n_estimators=100, max_depth=15, random_state=9)
|
clf = RandomForestClassifier(n_estimators=100, max_depth=15, random_state=9)
|
||||||
```
|
```
|
||||||
|
|
||||||
* classifyImage - predicts what kind of garbage is visible on a single image,
|
* classifyImage - predicts what kind of garbage is visible on a single image,
|
||||||
|
|
||||||
```
|
```
|
||||||
prediction = clf.predict(features)[0]
|
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.
|
* 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.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user