Add demo material
This commit is contained in:
parent
9e8ed73cf4
commit
9949125a5d
7 changed files with 148 additions and 2 deletions
BIN
data/VID_20220214_101740.mp4
(Stored with Git LFS)
Normal file
BIN
data/VID_20220214_101740.mp4
(Stored with Git LFS)
Normal file
Binary file not shown.
43
docs/project-demo/demo-material/demo.md
Normal file
43
docs/project-demo/demo-material/demo.md
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
1. Show Docker stuff
|
||||||
|
Explain: docker compose build
|
||||||
|
Run: docker compose run autophotographer
|
||||||
|
Run: cd /mmp-osp1
|
||||||
|
Run: pip install -e .
|
||||||
|
|
||||||
|
2. Explain missing function load_files()
|
||||||
|
Run: python src/autophotographer/autophotographer_main.py -i /datasets/Hannah/overcastjuly/melindwr1/output.avi
|
||||||
|
Explain: load_files() is never called
|
||||||
|
Explain: No logic for working with 0 compatible files
|
||||||
|
Edit: config file to disable ingore_video
|
||||||
|
Run: python src/autophotographer/autophotographer_main.py -i /datasets/Hannah/overcastjuly/melindwr1/output.avi
|
||||||
|
Explain: Tuple of file formats aren't a comprehensive method
|
||||||
|
Explain: Tries to load videos directly as images
|
||||||
|
Edit: config file to enable ingore_video
|
||||||
|
Explain: why frames are exported seperate to images
|
||||||
|
|
||||||
|
3. Show a successful run
|
||||||
|
Run: python src/autophotographer/autophotographer_main.py -i /datasets/Hannah/overcastjuly/melindwr1/*
|
||||||
|
Explain: ouput from command
|
||||||
|
|
||||||
|
4. Discuss filters
|
||||||
|
- Brightness (Upper and lower bounds)
|
||||||
|
- Contrast (Upper and lower bounds)
|
||||||
|
- Filesize (Lower bounds)
|
||||||
|
- Focus (Lower bounds)
|
||||||
|
- Laplacian
|
||||||
|
- Fast Fourier Transform
|
||||||
|
|
||||||
|
5. Discuss how contrast would be calculated (difference in luminance / min+max)
|
||||||
|
|
||||||
|
6. Automatic threshold calculation
|
||||||
|
Explain: Calculating thresholds from percentiles
|
||||||
|
|
||||||
|
7. CNN Performance
|
||||||
|
7.1 Run: A couple of images through
|
||||||
|
7.2 Run: Experiment 3
|
||||||
|
7.3 Run: Experiment 4
|
||||||
|
7.4 Discuss: Why ratings are exclusively between 5-7
|
||||||
|
|
||||||
|
8.
|
||||||
|
|
||||||
|
If there's time discuss Terraform
|
82
docs/project-demo/demo-material/helper-functions.py
Normal file
82
docs/project-demo/demo-material/helper-functions.py
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
import cv2
|
||||||
|
import os
|
||||||
|
from os.path import abspath
|
||||||
|
import datetime
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
from tqdm import tqdm
|
||||||
|
import random
|
||||||
|
|
||||||
|
# Export's video frames
|
||||||
|
def video_to_frames(path):
|
||||||
|
print("[INFO] Loading video...")
|
||||||
|
basename = os.path.splitext(os.path.split(path)[1])[0]
|
||||||
|
output_dir_name = basename + "_frames"
|
||||||
|
output_dir = os.path.join(os.path.split(path)[0], output_dir_name)
|
||||||
|
if not os.path.exists(output_dir):
|
||||||
|
os.makedirs(output_dir)
|
||||||
|
else:
|
||||||
|
print("[INFO] Outut folder \"{}\" already exists".format(output_dir))
|
||||||
|
return
|
||||||
|
stream = cv2.VideoCapture(path)
|
||||||
|
count = 0
|
||||||
|
print("[INFO] Reading and saving frames...")
|
||||||
|
while True:
|
||||||
|
(retrieved, frame) = stream.read()
|
||||||
|
if not retrieved:
|
||||||
|
break
|
||||||
|
count += 1
|
||||||
|
filename = "frame-{}.jpg".format(count)
|
||||||
|
path = os.path.abspath(os.path.join(output_dir, filename))
|
||||||
|
cv2.imwrite(path, frame)
|
||||||
|
print("[INFO] Frames saved to \"{}\"".format(output_dir))
|
||||||
|
|
||||||
|
# Plot images
|
||||||
|
def plot_images(paths):
|
||||||
|
# plot the images
|
||||||
|
number_of_images = len(paths)
|
||||||
|
if number_of_images % 5 == 0:
|
||||||
|
row = number_of_images // 5
|
||||||
|
else:
|
||||||
|
row = (number_of_images // 5) + 1
|
||||||
|
column = 5
|
||||||
|
width = 250
|
||||||
|
size = width * row
|
||||||
|
outputDir = os.path.join(os.path.dirname(__name__), "output")
|
||||||
|
fileName = datetime.datetime.now().strftime("%G-%m-%dT%H%M%S") + ".png"
|
||||||
|
filePath = os.path.join(outputDir, fileName)
|
||||||
|
|
||||||
|
if not os.path.exists(outputDir):
|
||||||
|
os.makedirs(outputDir)
|
||||||
|
|
||||||
|
heightOfFig = 6 * row
|
||||||
|
fig = plt.figure(figsize=(15, heightOfFig))
|
||||||
|
|
||||||
|
# Plot the 5 highest on the first row
|
||||||
|
plotIndex = 1
|
||||||
|
for path in tqdm(paths):
|
||||||
|
image = cv2.imread(path)
|
||||||
|
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
||||||
|
height = int(image.shape[0] * (width / image.shape[0]))
|
||||||
|
image = cv2.resize(image, (width, height))
|
||||||
|
fig.add_subplot(row, column, plotIndex)
|
||||||
|
plt.imshow(image)
|
||||||
|
plt.axis('off')
|
||||||
|
plt.title(os.path.split(path)[1])
|
||||||
|
plt.tight_layout()
|
||||||
|
plotIndex += 1
|
||||||
|
|
||||||
|
fig.tight_layout()
|
||||||
|
plt.savefig(filePath)
|
||||||
|
|
||||||
|
def list_dir_abs(directory):
|
||||||
|
dirAbsPath = os.path.abspath(directory)
|
||||||
|
listOfItems = os.listdir(directory)
|
||||||
|
listOfPaths = []
|
||||||
|
for item in listOfItems:
|
||||||
|
path = os.path.join(dirAbsPath, item)
|
||||||
|
listOfPaths.append(path)
|
||||||
|
return listOfPaths
|
||||||
|
|
||||||
|
def pickRandomNum(paths, num):
|
||||||
|
ranPaths = random.choices(paths, k=num)
|
||||||
|
return ranPaths
|
BIN
docs/project-demo/latex/img/HL-Diagram-CNN-Simplified.pdf
(Stored with Git LFS)
Normal file
BIN
docs/project-demo/latex/img/HL-Diagram-CNN-Simplified.pdf
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
docs/project-demo/latex/img/HL-Diagram-CNN.pdf
(Stored with Git LFS)
Normal file
BIN
docs/project-demo/latex/img/HL-Diagram-CNN.pdf
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
docs/project-demo/latex/presentation.pdf
(Stored with Git LFS)
BIN
docs/project-demo/latex/presentation.pdf
(Stored with Git LFS)
Binary file not shown.
|
@ -27,7 +27,19 @@
|
||||||
\includegraphics[width=\textwidth]{architecture-2}\\
|
\includegraphics[width=\textwidth]{architecture-2}\\
|
||||||
\end{figure}
|
\end{figure}
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
\begin{frame}
|
||||||
|
\begin{figure}
|
||||||
|
\centering
|
||||||
|
\includegraphics[height=0.95\textheight]{HL-Diagram-CNN}\\
|
||||||
|
\end{figure}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
\begin{frame}
|
||||||
|
\begin{figure}
|
||||||
|
\centering
|
||||||
|
\includegraphics[height=0.95\textheight]{HL-Diagram-CNN-Simplified}\\
|
||||||
|
\end{figure}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
%\begin{frame}
|
%\begin{frame}
|
||||||
% \tableofcontents
|
% \tableofcontents
|
||||||
|
|
Reference in a new issue