galdric/main.go
main.goRaw
1package main
2
3import (
4 "fmt"
5 "strconv"
6 "time"
7)
8
9func main() {
10 readConfig("./config.json")
11
12 c.Cyan("reading images datasets")
13 tStart := time.Now()
14 dataset := readDataset("./dataset")
15 fmt.Print("time spend reading images: ")
16 fmt.Println(time.Since(tStart))
17 fmt.Println("total folders scanned: " + strconv.Itoa(len(dataset)))
18
19 numImages := 0
20 for _, v := range dataset {
21 numImages = numImages + len(v)
22 }
23 c.Cyan("total images in dataset: " + strconv.Itoa(numImages))
24
25 //we have the images in the dataset variable
26 //now, can take images
27 testFile := readImage("./test.jpg")
28 r := knn(dataset, testFile)
29 fmt.Println("seems to be a " + r)
30
31}