-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCNN_1_cont_model.py
More file actions
86 lines (72 loc) · 6.06 KB
/
CNN_1_cont_model.py
File metadata and controls
86 lines (72 loc) · 6.06 KB
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
76
77
78
79
80
81
82
83
84
85
86
from keras.utils import *
import tensorflow as tf
import numpy as np
from keras.models import model_from_json
import Data_load_4 as dl
#modelname = input("Type Model's name :: ")
#modelname = "Model4_lstm_drop_adam_ep1000"
#modelname = "Model4_I3d3_ep500_case3"
#modelname = "Model4_ep1500_cutdatafor2_lr0002"
modelname = "Model_cnn_merge_ep2000"
modelname_json = "Models/" + modelname + ".json"
modelname_weight = "Models/" + modelname + ".h5"
json_file = open(modelname_json,"r")
loaded_model_json = json_file.read()
json_file.close()
model = tf.keras.models.model_from_json(loaded_model_json)
model.load_weights(modelname_weight)
print("Model Loaded...!")
def decision(predict):
print(predict)
if predict[0][0] > predict[0][1]:
return "None"
else:
return "Exist"
#human [0,0,1]
data = np.array([[
2476.0,2408.0,2298.0,2146.0,2072.0,2132.0,2134.0,2182.0,2088.0,2125.0,2102.0,2024.0,1912.0,1760.0,1692.0,1760.0,1806.0,1872.0,1828.0,1868.0,1840.0,1782.0,1680.0,1544.0,1472.0,1529.0,1598.0,1576.0,1521.0,1724.0,1868.0,1787.0,1809.0,1736.0,1641.0,1688.0,1696.0,1712.0,1620.0,1614.0,1550.0,1465.0,1337.0,1192.0,1113.0,1144.0,1214.0,1307.0,1264.0,1312.0,1296.0,1232.0,1129.0,1000.0,937.0,1034.0,1092.0,1184.0,1129.0,1194.0,1195.0,1161.0,1080.0,972.0,934.0,1044.0,1124.0,1197.0,1200.0,1256.0,1245.0,1202.0,1112.0,1006.0,961.0,1076.0,1164.0,1253.0,1256.0,1241.0,1216.0,1298.0,1379.0,1392.0,1317.0,1539.0,1746.0,1704.0,1528.0,1433.0,1276.0,1101.0,896.0,740.0,650.0,707.0,728.0,761.0,717.0,791.0
]])
data_other = np.array([[3980,25,31]])
#human [0,1]
data2 = np.array([[
1992.0,1930.0,1945.0,2100.0,2152.0,2096.0,2028.0,2062.0,2041.0,2112.0,2076.0,2054.0,2068.0,2234.0,2284.0,2240.0,2188.0,2208.0,2192.0,2250.0,2214.0,2168.0,2193.0,2304.0,2402.0,2356.0,2280.0,2288.0,2210.0,2298.0,2264.0,2168.0,2304.0,2642.0,2781.0,2724.0,2592.0,2520.0,2408.0,2384.0,2290.0,2180.0,2176.0,2252.0,2265.0,2182.0,2094.0,2104.0,2070.0,2120.0,2080.0,2042.0,2089.0,2217.0,2237.0,2156.0,2082.0,2068.0,2012.0,2096.0,2100.0,2076.0,2130.0,2234.0,2232.0,2140.0,2036.0,2042.0,1993.0,2024.0,1984.0,1948.0,2020.0,2124.0,2123.0,2036.0,1930.0,1926.0,1873.0,1883.0,1794.0,1776.0,1831.0,1972.0,2010.0,1924.0,1804.0,1736.0,1048.0,263.0,14.0,13.0,177.0,471.0,452.0,562.0,367.0,569.0,418.0,549.0
]])
data2_other = np.array([[4064,31,31]])
#none [1,0]
data3 = np.array([[
2504.0,2660.0,2870.0,2944.0,2944.0,3056.0,3059.0,3076.0,3056.0,2996.0,3048.0,2968.0,3064.0,3072.0,3077.0,3072.0,3081.0,3076.0,3074.0,3064.0,3067.0,3072.0,3072.0,3079.0,3080.0,3078.0,3081.0,3080.0,3076.0,3054.0,3056.0,3074.0,3078.0,3072.0,3075.0,3082.0,3079.0,3080.0,3036.0,2976.0,2912.0,2952.0,3058.0,3042.0,3083.0,3039.0,2960.0,2849.0,2721.0,2557.0,2503.0,2561.0,2605.0,2570.0,2621.0,2608.0,2552.0,2478.0,2356.0,2272.0,2248.0,2297.0,2365.0,2309.0,2355.0,2343.0,2291.0,2223.0,2129.0,2039.0,2048.0,2060.0,2134.0,2110.0,2163.0,2164.0,2100.0,2016.0,1908.0,1815.0,1830.0,1890.0,1962.0,1898.0,1950.0,1958.0,1916.0,1854.0,1755.0,1685.0,1760.0,1774.0,1833.0,1780.0,1836.0,1843.0,1811.0,1746.0,1666.0,1632.0
]])
data3_other = np.array([[4002,31,31]])
#none [1,0]
data4 = np.array([[
1662.0,1569.0,1562.0,1688.0,1865.0,1933.0,1928.0,1948.0,1912.0,1959.0,1899.0,1818.0,1832.0,1980.0,2104.0,2121.0,2072.0,2076.0,2038.0,2104.0,2051.0,1982.0,1991.0,2162.0,2228.0,2176.0,2122.0,2140.0,2110.0,2180.0,2128.0,2065.0,2083.0,2259.0,2321.0,2258.0,2209.0,2248.0,2196.0,2260.0,2215.0,2186.0,2198.0,2360.0,2410.0,2329.0,2279.0,2294.0,2252.0,2320.0,2275.0,2248.0,2254.0,2410.0,2480.0,2417.0,2360.0,2362.0,2321.0,2368.0,2340.0,2283.0,2314.0,2441.0,2541.0,2488.0,2410.0,2416.0,2348.0,2382.0,2334.0,2268.0,2296.0,2432.0,2464.0,2370.0,2296.0,2295.0,2242.0,2286.0,2240.0,2194.0,2262.0,2404.0,2432.0,2353.0,2278.0,2288.0,2236.0,2270.0,2232.0,2183.0,2269.0,2402.0,2432.0,2336.0,2264.0,2254.0,2233.0,2250.0
]])
data4_other = np.array([[4054,33,31]])
#human [0,1]
data5 = np.array([[
1865.0,1752.0,1824.0,1904.0,2089.0,2149.0,2124.0,2046.0,1950.0,1853.0,1717.0,1604.0,1726.0,1814.0,2004.0,2121.0,2137.0,2099.0,2024.0,1947.0,1809.0,1725.0,1835.0,1921.0,2109.0,2180.0,2176.0,2142.0,2088.0,2024.0,1904.0,1872.0,2028.0,2118.0,2304.0,2361.0,2330.0,2264.0,2171.0,2074.0,1911.0,1874.0,2040.0,2106.0,2273.0,2317.0,2278.0,2208.0,2113.0,2007.0,1862.0,1696.0,1853.0,2168.0,2548.0,2746.0,2816.0,2810.0,2760.0,2644.0,2464.0,2488.0,2624.0,2520.0,2502.0,2364.0,2136.0,1904.0,1662.0,1416.0,1218.0,1123.0,1254.0,1270.0,1392.0,1412.0,1376.0,1313.0,1246.0,1120.0,1024.0,1017.0,1231.0,1299.0,1467.0,1542.0,1536.0,1492.0,1441.0,1337.0,1268.0,1272.0,1484.0,1553.0,1717.0,1788.0,1773.0,1724.0,1664.0,1572.0
]])
data5_other = np.array([[2500,25,31]])
#human[0,1]
data6 = np.array([[
2355.0,2290.0,2162.0,2006.0,1915.0,2002.0,2005.0,1964.0,1887.0,1788.0,1761.0,1696.0,1548.0,1380.0,1287.0,1341.0,1340.0,1292.0,1089.0,1049.0,979.0,906.0,780.0,674.0,659.0,810.0,919.0,1018.0,985.0,1098.0,1132.0,1106.0,1017.0,934.0,953.0,1146.0,1295.0,1524.0,1611.0,1852.0,2041.0,2200.0,2278.0,2353.0,2520.0,2800.0,3019.0,3072.0,3072.0,3076.0,3076.0,3072.0,3072.0,3060.0,3073.0,3072.0,3072.0,3080.0,3060.0,3072.0,3077.0,3072.0,3068.0,3060.0,3072.0,3072.0,3072.0,3065.0,3021.0,3074.0,3076.0,3040.0,2925.0,2788.0,2732.0,2788.0,2743.0,2720.0,2522.0,2499.0,2442.0,2322.0,2173.0,2022.0,2007.0,2073.0,2062.0,2084.0,1940.0,1977.0,1970.0,1912.0,1824.0,1754.0,1839.0,1932.0,2048.0,2160.0,2094.0,2185.0
]])
data6_other = np.array([[4027,27,29]])
data = np.reshape(data, (int(data.__len__()), 1, 10, 10))
data2 = np.reshape(data2, (int(data2.__len__()), 1, 10, 10))
data3 = np.reshape(data3, (int(data3.__len__()), 1, 10, 10))
data4 = np.reshape(data4, (int(data4.__len__()), 1, 10, 10))
data5 = np.reshape(data5, (int(data5.__len__()), 1, 10, 10))
data6 = np.reshape(data6, (int(data6.__len__()), 1, 10, 10))
result = decision(model.predict([data,data_other]))
print(result)
result2 = decision(model.predict([data2,data2_other]))
print(result2)
result3 = decision(model.predict([data3,data3_other]))
print(result3)
result4 = decision(model.predict([data4,data4_other]))
print(result4)
result5 = decision(model.predict([data5,data5_other]))
print(result5)
result6 = decision(model.predict([data6,data6_other]))
print(result6)