diff --git a/data/VID_20220214_101740.mp4 b/data/VID_20220214_101740.mp4 new file mode 100644 index 0000000..1d5e8fa --- /dev/null +++ b/data/VID_20220214_101740.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d26f3e9eca643ad04a001d9ac6d33afcff20b6411a32e8a30c643a8647724b84 +size 164545500 diff --git a/docs/project-demo/demo-material/demo.md b/docs/project-demo/demo-material/demo.md new file mode 100644 index 0000000..a0728f9 --- /dev/null +++ b/docs/project-demo/demo-material/demo.md @@ -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 diff --git a/docs/project-demo/demo-material/helper-functions.py b/docs/project-demo/demo-material/helper-functions.py new file mode 100644 index 0000000..55fecdf --- /dev/null +++ b/docs/project-demo/demo-material/helper-functions.py @@ -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 \ No newline at end of file diff --git a/docs/project-demo/latex/img/HL-Diagram-CNN-Simplified.pdf b/docs/project-demo/latex/img/HL-Diagram-CNN-Simplified.pdf new file mode 100644 index 0000000..0755762 --- /dev/null +++ b/docs/project-demo/latex/img/HL-Diagram-CNN-Simplified.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:521edd694fb6e5c47cf80862fa2e7ab7066ad7b2bab08703d857130864428219 +size 61504 diff --git a/docs/project-demo/latex/img/HL-Diagram-CNN.pdf b/docs/project-demo/latex/img/HL-Diagram-CNN.pdf new file mode 100644 index 0000000..d64190a --- /dev/null +++ b/docs/project-demo/latex/img/HL-Diagram-CNN.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:685e65e8bc3f249eb1141dc2dc28d8c7abb6f5a380a2e26b9ae5830146af0221 +size 149527 diff --git a/docs/project-demo/latex/presentation.pdf b/docs/project-demo/latex/presentation.pdf index 6bbadf5..d11941b 100644 --- a/docs/project-demo/latex/presentation.pdf +++ b/docs/project-demo/latex/presentation.pdf @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:47dfa7488a24b1e52bab5f335d61c2aa5ccd52df030d840320fe143cba3d1143 -size 112968 +oid sha256:53c6227533c5a2e60b8fd2e2b8f1d67e0a4be5919e1b12dc3dabd7376e8518f3 +size 325928 diff --git a/docs/project-demo/latex/presentation.tex b/docs/project-demo/latex/presentation.tex index 0657c03..867b001 100644 --- a/docs/project-demo/latex/presentation.tex +++ b/docs/project-demo/latex/presentation.tex @@ -27,7 +27,19 @@ \includegraphics[width=\textwidth]{architecture-2}\\ \end{figure} \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} % \tableofcontents