File tree Expand file tree Collapse file tree 5 files changed +27
-460
lines changed
Expand file tree Collapse file tree 5 files changed +27
-460
lines changed Original file line number Diff line number Diff line change 1-
21module GraphicInterface where
32
43
4+ import System.Directory
5+ import Data.List
6+
57
68{- -
79example path: "data/traindata/img/10_12/big_numbers/0.pgm"
@@ -22,3 +24,23 @@ readPPMFile fn = do
2224normalize x = norm where
2325z = read x :: Double
2426norm = z / 255
27+
28+
29+ -- returns a list of inputvalues from the given ppm folder.
30+ -- reads every ppm and generates its inputValues from the pixels values
31+ getPPMInput :: String -> IO [[Double ]]
32+ getPPMInput path = do
33+ let fullPath = path-- dataPath ++ path
34+ nameList <- getPgmList fullPath
35+ fileList <- mapM readPPMFile (map (\ x -> fullPath ++ x) nameList)
36+
37+ return fileList
38+
39+
40+ -- scans a directory for ppm files and returns a list of their filenames
41+ getPgmList :: String -> IO [String ]
42+ getPgmList path = do
43+ dirContent <- getDirectoryContents path
44+ let pgmList = filter (isSuffixOf " .pgm" ) dirContent
45+ return $ sort pgmList
46+
Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ import Neuron
55import Trainingdata
66import Backpropagation
77import Utils
8- import Config
98import TopologyParser
109import TraindataParser
1110import GraphicInterface
Load Diff Large diffs are not rendered by default.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments