Showing
6 changed files
with
269 additions
and
13 deletions
1 | # Installation | 1 | # Installation |
2 | 2 | ||
3 | -<!-- 1. Create conda env --> | 3 | +> This setup is tested only in Apple Silicon(M1). |
4 | 4 | ||
5 | - <!-- ```bash --> | 5 | +1. Create conda env |
6 | - <!-- ~$ conda env create --name {any_names_you_want} --file environment.yaml --> | ||
7 | - <!-- ``` --> | ||
8 | 6 | ||
9 | -<!-- 2. Activate conda env --> | 7 | + ```bash |
8 | + ~$ conda env create --name {any_names_you_want} --file environment.yaml | ||
9 | + ``` | ||
10 | 10 | ||
11 | - <!-- ```bash --> | 11 | +2. Activate conda env |
12 | - <!-- ~$ conda activate {any_names_you_want} --> | ||
13 | - <!-- ``` --> | ||
14 | 12 | ||
15 | -<!-- 3. Install some packages manually --> | 13 | + ```bash |
14 | + ~$ conda activate {any_names_you_want} | ||
15 | + ``` | ||
16 | 16 | ||
17 | - <!-- ```bash --> | 17 | +3. Install some packages manually |
18 | - <!-- ~$ pip install pygame --> | 18 | + |
19 | - <!-- ``` --> | 19 | + ```bash |
20 | + ~$ pip install -r requirements.txt | ||
21 | + ``` | ||
20 | 22 | ||
21 | # Dataset | 23 | # Dataset |
22 | 24 | ... | ... |
DetectModel/environment.yaml
0 → 100644
1 | +name: drowsiness_detector | ||
2 | +channels: | ||
3 | + - apple | ||
4 | + - defaults | ||
5 | + - conda-forge | ||
6 | +dependencies: | ||
7 | + - aom=3.3.0=h07bb92c_1 | ||
8 | + - appnope=0.1.2=py39hca03da5_1001 | ||
9 | + - asttokens=2.0.5=pyhd3eb1b0_0 | ||
10 | + - backcall=0.2.0=pyhd3eb1b0_0 | ||
11 | + - blas=2.114=openblas | ||
12 | + - blas-devel=3.9.0=14_osxarm64_openblas | ||
13 | + - brotli=1.0.7=hc377ac9_0 | ||
14 | + - bzip2=1.0.8=h620ffc9_4 | ||
15 | + - c-ares=1.18.1=h1a28f6b_0 | ||
16 | + - ca-certificates=2022.4.26=hca03da5_0 | ||
17 | + - cairo=1.16.0=h0ab239c_1 | ||
18 | + - certifi=2021.10.8=py39hca03da5_2 | ||
19 | + - cycler=0.11.0=pyhd3eb1b0_0 | ||
20 | + - debugpy=1.5.1=py39hc377ac9_0 | ||
21 | + - decorator=5.1.1=pyhd3eb1b0_0 | ||
22 | + - entrypoints=0.4=py39hca03da5_0 | ||
23 | + - executing=0.8.3=pyhd3eb1b0_0 | ||
24 | + - ffmpeg=4.4.1=heb85afd_3 | ||
25 | + - fontconfig=2.13.1=h1f4a5ec_0 | ||
26 | + - fonttools=4.25.0=pyhd3eb1b0_0 | ||
27 | + - freetype=2.11.0=h1192e45_0 | ||
28 | + - gettext=0.21.0=h826f4ad_0 | ||
29 | + - giflib=5.2.1=h1a28f6b_0 | ||
30 | + - glib=2.70.2=hccf11d3_4 | ||
31 | + - glib-tools=2.70.2=hccf11d3_4 | ||
32 | + - gmp=6.2.1=hc377ac9_0 | ||
33 | + - gnutls=3.6.15=h887c41c_0 | ||
34 | + - graphite2=1.3.14=h0e5e14a_0 | ||
35 | + - grpcio=1.42.0=py39h95c9599_0 | ||
36 | + - h5py=3.6.0=py39h7fe8675_0 | ||
37 | + - harfbuzz=4.2.1=hd36a07e_0 | ||
38 | + - hdf5=1.12.1=h5aa262f_1 | ||
39 | + - icu=70.1=h6b3803e_0 | ||
40 | + - ipykernel=6.9.1=py39hca03da5_0 | ||
41 | + - ipython=8.3.0=py39hca03da5_0 | ||
42 | + - jasper=2.0.33=hba35424_0 | ||
43 | + - jbig=2.1=h1a28f6b_0 | ||
44 | + - jedi=0.18.1=py39hca03da5_1 | ||
45 | + - jpeg=9e=h1a28f6b_0 | ||
46 | + - jupyter_client=7.2.2=py39hca03da5_0 | ||
47 | + - jupyter_core=4.10.0=py39hca03da5_0 | ||
48 | + - kiwisolver=1.3.2=py39hc377ac9_0 | ||
49 | + - krb5=1.19.2=h3b8d789_0 | ||
50 | + - lame=3.100=h1a28f6b_0 | ||
51 | + - lcms2=2.12=hba8e193_0 | ||
52 | + - lerc=3.0=hc377ac9_0 | ||
53 | + - libblas=3.9.0=14_osxarm64_openblas | ||
54 | + - libcblas=3.9.0=14_osxarm64_openblas | ||
55 | + - libcurl=7.82.0=hc6d1d07_0 | ||
56 | + - libcxx=14.0.3=h6a5c8ee_0 | ||
57 | + - libdeflate=1.8=h1a28f6b_5 | ||
58 | + - libedit=3.1.20210910=h1a28f6b_0 | ||
59 | + - libev=4.33=h1a28f6b_1 | ||
60 | + - libffi=3.4.2=hc377ac9_2 | ||
61 | + - libgfortran=5.0.0=11_1_0_h6a59814_26 | ||
62 | + - libgfortran5=11.1.0=h6a59814_26 | ||
63 | + - libglib=2.70.2=h67e64d8_4 | ||
64 | + - libiconv=1.16=h1a28f6b_2 | ||
65 | + - libidn2=2.3.1=h1a28f6b_0 | ||
66 | + - liblapack=3.9.0=14_osxarm64_openblas | ||
67 | + - liblapacke=3.9.0=14_osxarm64_openblas | ||
68 | + - libnghttp2=1.46.0=h95c9599_0 | ||
69 | + - libopenblas=0.3.20=openmp_h2209c59_0 | ||
70 | + - libopencv=4.5.5=py39h86e1ac9_9 | ||
71 | + - libpng=1.6.37=hb8d0fd4_0 | ||
72 | + - libprotobuf=3.20.1=h332123e_0 | ||
73 | + - libsodium=1.0.18=h1a28f6b_0 | ||
74 | + - libssh2=1.10.0=hf27765b_0 | ||
75 | + - libtasn1=4.16.0=h1a28f6b_0 | ||
76 | + - libtiff=4.3.0=h74060c4_2 | ||
77 | + - libunistring=0.9.10=h1a28f6b_0 | ||
78 | + - libvpx=1.11.0=hc377ac9_0 | ||
79 | + - libwebp=1.2.2=h68602c7_0 | ||
80 | + - libwebp-base=1.2.2=h1a28f6b_0 | ||
81 | + - libxml2=2.9.14=h035c1df_0 | ||
82 | + - libzlib=1.2.11=h90dfc92_1014 | ||
83 | + - llvm-openmp=14.0.3=hd125106_0 | ||
84 | + - lz4-c=1.9.3=hc377ac9_0 | ||
85 | + - matplotlib=3.5.1=py39hca03da5_1 | ||
86 | + - matplotlib-base=3.5.1=py39hc377ac9_1 | ||
87 | + - matplotlib-inline=0.1.2=pyhd3eb1b0_2 | ||
88 | + - munkres=1.1.4=py_0 | ||
89 | + - ncurses=6.3=h1a28f6b_2 | ||
90 | + - nest-asyncio=1.5.5=py39hca03da5_0 | ||
91 | + - nettle=3.7.3=h84b5d62_1 | ||
92 | + - numpy=1.21.5=py39h25ab29e_2 | ||
93 | + - numpy-base=1.21.5=py39h974a1f5_2 | ||
94 | + - openblas=0.3.20=openmp_h745f6c2_0 | ||
95 | + - opencv=4.5.5=py39hdf13c20_9 | ||
96 | + - openh264=2.1.1=h98b2900_0 | ||
97 | + - openssl=1.1.1o=h1a28f6b_0 | ||
98 | + - packaging=21.3=pyhd3eb1b0_0 | ||
99 | + - parso=0.8.3=pyhd3eb1b0_0 | ||
100 | + - pcre=8.45=hc377ac9_0 | ||
101 | + - pexpect=4.8.0=pyhd3eb1b0_3 | ||
102 | + - pickleshare=0.7.5=pyhd3eb1b0_1003 | ||
103 | + - pillow=9.0.1=py39h4d1bdd5_0 | ||
104 | + - pip=21.2.4=py39hca03da5_0 | ||
105 | + - pixman=0.40.0=h1a28f6b_0 | ||
106 | + - prompt-toolkit=3.0.20=pyhd3eb1b0_0 | ||
107 | + - ptyprocess=0.7.0=pyhd3eb1b0_2 | ||
108 | + - pure_eval=0.2.2=pyhd3eb1b0_0 | ||
109 | + - py-opencv=4.5.5=py39hfa6204d_9 | ||
110 | + - pygments=2.11.2=pyhd3eb1b0_0 | ||
111 | + - pyparsing=3.0.4=pyhd3eb1b0_0 | ||
112 | + - python=3.9.12=hfc7342c_1_cpython | ||
113 | + - python-dateutil=2.8.2=pyhd3eb1b0_0 | ||
114 | + - python_abi=3.9=2_cp39 | ||
115 | + - pyzmq=22.3.0=py39hc377ac9_2 | ||
116 | + - readline=8.1.2=h1a28f6b_1 | ||
117 | + - scipy=1.7.3=py39h2f0f56f_0 | ||
118 | + - setuptools=61.2.0=py39hca03da5_0 | ||
119 | + - sqlite=3.38.2=h1058600_0 | ||
120 | + - stack_data=0.2.0=pyhd3eb1b0_0 | ||
121 | + - svt-av1=0.9.1=h07bb92c_0 | ||
122 | + - tensorflow-deps=2.8.0=0 | ||
123 | + - tk=8.6.12=he1e0b03_0 | ||
124 | + - tornado=6.1=py39h1a28f6b_0 | ||
125 | + - traitlets=5.1.1=pyhd3eb1b0_0 | ||
126 | + - tzdata=2022a=hda174b7_0 | ||
127 | + - wcwidth=0.2.5=pyhd3eb1b0_0 | ||
128 | + - wheel=0.37.1=pyhd3eb1b0_0 | ||
129 | + - x264=1!161.3030=h3422bc3_1 | ||
130 | + - x265=3.5=hbc6ce65_3 | ||
131 | + - xz=5.2.5=h1a28f6b_1 | ||
132 | + - zeromq=4.3.4=hc377ac9_0 | ||
133 | + - zlib=1.2.11=h90dfc92_1014 | ||
134 | + - zstd=1.5.2=h861e0a7_0 | ||
135 | + - pip: | ||
136 | + - absl-py==1.0.0 | ||
137 | + - astunparse==1.6.3 | ||
138 | + - cachetools==5.0.0 | ||
139 | + - charset-normalizer==2.0.12 | ||
140 | + - flatbuffers==2.0 | ||
141 | + - gast==0.5.3 | ||
142 | + - google-auth==2.6.6 | ||
143 | + - google-auth-oauthlib==0.4.6 | ||
144 | + - google-pasta==0.2.0 | ||
145 | + - idna==3.3 | ||
146 | + - importlib-metadata==4.11.3 | ||
147 | + - imutils==0.5.4 | ||
148 | + - keras==2.8.0 | ||
149 | + - keras-preprocessing==1.1.2 | ||
150 | + - libclang==14.0.1 | ||
151 | + - markdown==3.3.7 | ||
152 | + - oauthlib==3.2.0 | ||
153 | + - opt-einsum==3.3.0 | ||
154 | + - protobuf==3.20.1 | ||
155 | + - pyasn1==0.4.8 | ||
156 | + - pyasn1-modules==0.2.8 | ||
157 | + - pygame==2.1.2 | ||
158 | + - requests==2.27.1 | ||
159 | + - requests-oauthlib==1.3.1 | ||
160 | + - rsa==4.8 | ||
161 | + - six==1.15.0 | ||
162 | + - tensorboard==2.8.0 | ||
163 | + - tensorboard-data-server==0.6.1 | ||
164 | + - tensorboard-plugin-wit==1.8.1 | ||
165 | + - tensorflow-macos==2.8.0 | ||
166 | + - tensorflow-metal==0.4.0 | ||
167 | + - termcolor==1.1.0 | ||
168 | + - tf-estimator-nightly==2.8.0.dev2021122109 | ||
169 | + - typing-extensions==4.2.0 | ||
170 | + - urllib3==1.26.9 | ||
171 | + - werkzeug==2.1.2 | ||
172 | + - wrapt==1.14.1 | ||
173 | + - zipp==3.8.0 | ||
174 | +prefix: /Users/skywrace/miniforge3/envs/drowsiness_detector |
... | @@ -34,7 +34,8 @@ def main(): | ... | @@ -34,7 +34,8 @@ def main(): |
34 | eye = eye/255 | 34 | eye = eye/255 |
35 | eye = eye.reshape(24, 24, -1) | 35 | eye = eye.reshape(24, 24, -1) |
36 | eye = np.expand_dims(eye, axis=0) | 36 | eye = np.expand_dims(eye, axis=0) |
37 | - pred = model.predict_classes(eye) | 37 | + prob = model.predict(eye, verbose=0) |
38 | + pred = prob.argmax(axis=-1) | ||
38 | return True if pred[0] == 1 else False | 39 | return True if pred[0] == 1 else False |
39 | 40 | ||
40 | while True: | 41 | while True: | ... | ... |
This file is too large to display.
This diff could not be displayed because it is too large.
DetectModel/requirements.txt
0 → 100644
1 | +absl-py==1.0.0 | ||
2 | +appnope @ file:///Users/ktietz/demo/mc3/conda-bld/appnope_1629146036738/work | ||
3 | +asttokens @ file:///opt/conda/conda-bld/asttokens_1646925590279/work | ||
4 | +astunparse==1.6.3 | ||
5 | +backcall @ file:///home/ktietz/src/ci/backcall_1611930011877/work | ||
6 | +cachetools==5.0.0 | ||
7 | +certifi==2021.10.8 | ||
8 | +charset-normalizer==2.0.12 | ||
9 | +cycler @ file:///tmp/build/80754af9/cycler_1637851556182/work | ||
10 | +debugpy @ file:///Users/builder/miniconda3/envs/prefect/conda-bld/debugpy_1637092214173/work | ||
11 | +decorator @ file:///opt/conda/conda-bld/decorator_1643638310831/work | ||
12 | +entrypoints @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_croot-jb01gaox/entrypoints_1650293758411/work | ||
13 | +executing @ file:///opt/conda/conda-bld/executing_1646925071911/work | ||
14 | +flatbuffers==2.0 | ||
15 | +fonttools==4.25.0 | ||
16 | +gast==0.5.3 | ||
17 | +google-auth==2.6.6 | ||
18 | +google-auth-oauthlib==0.4.6 | ||
19 | +google-pasta==0.2.0 | ||
20 | +grpcio @ file:///Users/builder/miniconda3/envs/prefect/conda-bld/grpcio_1637592348692/work | ||
21 | +h5py @ file:///Users/builder/miniconda3/envs/prefect/conda-bld/h5py_1637162753555/work | ||
22 | +idna==3.3 | ||
23 | +importlib-metadata==4.11.3 | ||
24 | +imutils==0.5.4 | ||
25 | +ipykernel @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_croot-4yxj69n0/ipykernel_1647009452031/work/dist/ipykernel-6.9.1-py3-none-any.whl | ||
26 | +ipython @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_b42ce53b-9348-4ffe-874e-ee7a7d34be58zn88hkt_/croots/recipe/ipython_1651600151534/work | ||
27 | +jedi @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/croot-f1t6hma6/jedi_1644315882177/work | ||
28 | +jupyter-client @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_37f0874a-8189-43c8-984a-7cc5aa7f2a00vekz677y/croots/recipe/jupyter_client_1650622203010/work | ||
29 | +jupyter-core @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_5839c60e-0f30-4a99-b0b9-2b009ec5fec40y9fo9ym/croots/recipe/jupyter_core_1651671230982/work | ||
30 | +keras==2.8.0 | ||
31 | +Keras-Preprocessing==1.1.2 | ||
32 | +kiwisolver @ file:///Users/builder/miniconda3/envs/prefect/conda-bld/kiwisolver_1638569888412/work | ||
33 | +libclang==14.0.1 | ||
34 | +Markdown==3.3.7 | ||
35 | +matplotlib @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_croot-_3usbnl1/matplotlib-suite_1647506475477/work | ||
36 | +matplotlib-inline @ file:///tmp/build/80754af9/matplotlib-inline_1628242447089/work | ||
37 | +munkres==1.1.4 | ||
38 | +nest-asyncio @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_croot-xymukih3/nest-asyncio_1649931465456/work | ||
39 | +numpy @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_e99dd190-62ea-4b66-a328-d961062afa8ar4io6k3p/croots/recipe/numpy_and_numpy_base_1651563626935/work | ||
40 | +oauthlib==3.2.0 | ||
41 | +opencv-python==4.5.5 | ||
42 | +opt-einsum==3.3.0 | ||
43 | +packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work | ||
44 | +parso @ file:///opt/conda/conda-bld/parso_1641458642106/work | ||
45 | +pexpect @ file:///tmp/build/80754af9/pexpect_1605563209008/work | ||
46 | +pickleshare @ file:///tmp/build/80754af9/pickleshare_1606932040724/work | ||
47 | +Pillow==9.0.1 | ||
48 | +prompt-toolkit @ file:///tmp/build/80754af9/prompt-toolkit_1633440160888/work | ||
49 | +protobuf==3.20.1 | ||
50 | +ptyprocess @ file:///tmp/build/80754af9/ptyprocess_1609355006118/work/dist/ptyprocess-0.7.0-py2.py3-none-any.whl | ||
51 | +pure-eval @ file:///opt/conda/conda-bld/pure_eval_1646925070566/work | ||
52 | +pyasn1==0.4.8 | ||
53 | +pyasn1-modules==0.2.8 | ||
54 | +pygame==2.1.2 | ||
55 | +Pygments @ file:///opt/conda/conda-bld/pygments_1644249106324/work | ||
56 | +pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work | ||
57 | +python-dateutil @ file:///tmp/build/80754af9/python-dateutil_1626374649649/work | ||
58 | +pyzmq @ file:///Users/builder/miniconda3/envs/prefect/conda-bld/pyzmq_1638447141825/work | ||
59 | +requests==2.27.1 | ||
60 | +requests-oauthlib==1.3.1 | ||
61 | +rsa==4.8 | ||
62 | +scipy @ file:///Users/ktietz/ci_310/scipy_1644255974431/work | ||
63 | +six==1.15.0 | ||
64 | +stack-data @ file:///opt/conda/conda-bld/stack_data_1646927590127/work | ||
65 | +tensorboard==2.8.0 | ||
66 | +tensorboard-data-server==0.6.1 | ||
67 | +tensorboard-plugin-wit==1.8.1 | ||
68 | +tensorflow-macos==2.8.0 | ||
69 | +tensorflow-metal==0.4.0 | ||
70 | +termcolor==1.1.0 | ||
71 | +tf-estimator-nightly==2.8.0.dev2021122109 | ||
72 | +tornado @ file:///Users/ktietz/demo/mc3/conda-bld/tornado_1628698929452/work | ||
73 | +traitlets @ file:///tmp/build/80754af9/traitlets_1636710298902/work | ||
74 | +typing_extensions==4.2.0 | ||
75 | +urllib3==1.26.9 | ||
76 | +wcwidth @ file:///Users/ktietz/demo/mc3/conda-bld/wcwidth_1629357192024/work | ||
77 | +Werkzeug==2.1.2 | ||
78 | +wrapt==1.14.1 | ||
79 | +zipp==3.8.0 |
-
Please register or login to post a comment