-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrainonebyone.php
75 lines (62 loc) · 2.07 KB
/
trainonebyone.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
require 'function.php';
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Feature Extraction</title>
<link rel="stylesheet" type="text/css" href="semantic/dist/semantic.min.css">
<script
src="https://code.jquery.com/jquery-3.1.1.min.js"
integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
crossorigin="anonymous"></script>
<script src="semantic/dist/semantic.min.js"></script>
</head>
<body>
<div class="ui container">
<div class="ui segment">
<?php
$folder = new DirectoryIterator('img');
$total = 0;
foreach ($folder as $fileInfo) {
if($fileInfo->isDot())
continue;
else if(isInDatabase($fileInfo->getFilename())) continue;
else if (!isset($nextfile)) $nextfile = $fileInfo->getFilename();
$total++;
}
if ($total > 0){
echo "<p>Found ".$total." unprocessed images</p>\n";
echo "<p>Processing image ".$nextfile."..</p>\n";
//start timer
$start = microtime(true);
ProcessImage($nextfile);
$end = microtime(true) - $start;
echo "<p>Done!</p>\n";
echo "<p>Process time: ".number_format($end,2). " secs</p>";
}
else{
echo "<p>No unprocessed images found</p>\n";
}
function isInDatabase($filename) {
require 'config.php';
$result = mysqli_query($connection,"SELECT count(*) FROM images WHERE filename='".$filename."'");
while($row = mysqli_fetch_array($result))
$imagesnum = $row[0];
if ($imagesnum > 0)
return true;
else
return false;
}
?>
<button class="ui button" onclick="window.open("index.php","_self"); window.open("index.php","_self");">
Back
</button>
<button class="ui primary button" onclick="window.open("train.php","_self"); window.open("train.php","_self");">
Go
</button>
</div>
</div>
</body>
</html>