{"id":76,"date":"2024-02-22T18:13:13","date_gmt":"2024-02-22T18:13:13","guid":{"rendered":"https:\/\/citestu17.savecicadabuzz.org\/?page_id=76"},"modified":"2024-04-25T16:52:28","modified_gmt":"2024-04-25T16:52:28","slug":"document-classification","status":"publish","type":"page","link":"https:\/\/citestu17.savecicadabuzz.org\/index.php\/document-classification\/","title":{"rendered":"Document Classification"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"76\" class=\"elementor elementor-76\">\n\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-246c689 e-flex e-con-boxed e-con e-parent\" data-id=\"246c689\" data-element_type=\"container\" data-settings=\"{&quot;content_width&quot;:&quot;boxed&quot;}\" data-core-v316-plus=\"true\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-305ee6b elementor-widget elementor-widget-heading\" data-id=\"305ee6b\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<style>\/*! elementor - v3.18.0 - 20-12-2023 *\/\n.elementor-heading-title{padding:0;margin:0;line-height:1}.elementor-widget-heading .elementor-heading-title[class*=elementor-size-]>a{color:inherit;font-size:inherit;line-height:inherit}.elementor-widget-heading .elementor-heading-title.elementor-size-small{font-size:15px}.elementor-widget-heading .elementor-heading-title.elementor-size-medium{font-size:19px}.elementor-widget-heading .elementor-heading-title.elementor-size-large{font-size:29px}.elementor-widget-heading .elementor-heading-title.elementor-size-xl{font-size:39px}.elementor-widget-heading .elementor-heading-title.elementor-size-xxl{font-size:59px}<\/style><h2 class=\"elementor-heading-title elementor-size-large\">Document Classification <\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-53439c6 e-flex e-con-boxed e-con e-parent\" data-id=\"53439c6\" data-element_type=\"container\" data-settings=\"{&quot;content_width&quot;:&quot;boxed&quot;}\" data-core-v316-plus=\"true\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-e2af786 elementor-widget elementor-widget-text-editor\" data-id=\"e2af786\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<style>\/*! elementor - v3.18.0 - 20-12-2023 *\/\n.elementor-widget-text-editor.elementor-drop-cap-view-stacked .elementor-drop-cap{background-color:#69727d;color:#fff}.elementor-widget-text-editor.elementor-drop-cap-view-framed .elementor-drop-cap{color:#69727d;border:3px solid;background-color:transparent}.elementor-widget-text-editor:not(.elementor-drop-cap-view-default) .elementor-drop-cap{margin-top:8px}.elementor-widget-text-editor:not(.elementor-drop-cap-view-default) .elementor-drop-cap-letter{width:1em;height:1em}.elementor-widget-text-editor .elementor-drop-cap{float:left;text-align:center;line-height:1;font-size:50px}.elementor-widget-text-editor .elementor-drop-cap-letter{display:inline-block}<\/style>\t\t\t\t<p>Reflect on the following question: You\u2019ll have to think about how to train the machine.\u00a0 What kind of data did you include in your training dataset and why? What other kind of data could have been helpful but maybe you couldn\u2019t get in the short-term\/for free? Your group may, in some cases, search for photograph sets.\u00a0 One possibility to get large data sets is to convert YouTubes into clips. Did your model work well for what you wanted?\u00a0 In what instances might your model not work very well?\u00a0 Include the link to your project.<\/p><p>\u00a0<\/p><p>In our data training set, we included multiple Google pictures of cats and kittens. A Youtube video condensed to photos could have been helpful to get if time was not a factor in our situation. No our model did not work well for what we wanted because it classifying people and objects as cats, that are clearly not cats. Our model lacks when falsely identifying things that are not cats or kittens, so in a situation where a cat or kitten is not the object in front of the camera, then false data would be given.\u00a0<\/p><p>\u00a0<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-694defd e-flex e-con-boxed e-con e-parent\" data-id=\"694defd\" data-element_type=\"container\" data-settings=\"{&quot;content_width&quot;:&quot;boxed&quot;}\" data-core-v316-plus=\"true\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-a30cd28 e-flex e-con-boxed e-con e-parent\" data-id=\"a30cd28\" data-element_type=\"container\" data-settings=\"{&quot;content_width&quot;:&quot;boxed&quot;}\" data-core-v316-plus=\"true\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-6020e91 elementor-widget elementor-widget-text-editor\" data-id=\"6020e91\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>from keras.models import load_model # TensorFlow is required for Keras to work<br \/>from PIL import Image, ImageOps # Install pillow instead of PIL<br \/>import numpy as np<\/p><p># Disable scientific notation for clarity<br \/>np.set_printoptions(suppress=True)<\/p><p># Load the model<br \/>model = load_model(&#8220;keras_Model.h5&#8221;, compile=False)<\/p><p># Load the labels<br \/>class_names = open(&#8220;labels.txt&#8221;, &#8220;r&#8221;).readlines()<\/p><p># Create the array of the right shape to feed into the keras model<br \/># The &#8216;length&#8217; or number of images you can put into the array is<br \/># determined by the first position in the shape tuple, in this case 1<br \/>data = np.ndarray(shape=(1, 224, 224, 3), dtype=np.float32)<\/p><p># Replace this with the path to your image<br \/>image = Image.open(&#8220;&lt;IMAGE_PATH&gt;&#8221;).convert(&#8220;RGB&#8221;)<\/p><p># resizing the image to be at least 224&#215;224 and then cropping from the center<br \/>size = (224, 224)<br \/>image = ImageOps.fit(image, size, Image.Resampling.LANCZOS)<\/p><p># turn the image into a numpy array<br \/>image_array = np.asarray(image)<\/p><p># Normalize the image<br \/>normalized_image_array = (image_array.astype(np.float32) \/ 127.5) &#8211; 1<\/p><p># Load the image into the array<br \/>data[0] = normalized_image_array<\/p><p># Predicts the model<br \/>prediction = model.predict(data)<br \/>index = np.argmax(prediction)<br \/>class_name = class_names[index]<br \/>confidence_score = prediction[0][index]<\/p><p># Print prediction and confidence score<br \/>print(&#8220;Class:&#8221;, class_name[2:], end=&#8221;&#8221;)<br \/>print(&#8220;Confidence Score:&#8221;, confidence_score)<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Document Classification Reflect on the following question: You\u2019ll have to think about how to train the machine.\u00a0 What kind of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"no-sidebar","site-content-layout":"","ast-site-content-layout":"full-width-container","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"disabled","ast-breadcrumbs-content":"","ast-featured-img":"disabled","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"footnotes":""},"class_list":["post-76","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/citestu17.savecicadabuzz.org\/index.php\/wp-json\/wp\/v2\/pages\/76","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/citestu17.savecicadabuzz.org\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/citestu17.savecicadabuzz.org\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/citestu17.savecicadabuzz.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/citestu17.savecicadabuzz.org\/index.php\/wp-json\/wp\/v2\/comments?post=76"}],"version-history":[{"count":14,"href":"https:\/\/citestu17.savecicadabuzz.org\/index.php\/wp-json\/wp\/v2\/pages\/76\/revisions"}],"predecessor-version":[{"id":185,"href":"https:\/\/citestu17.savecicadabuzz.org\/index.php\/wp-json\/wp\/v2\/pages\/76\/revisions\/185"}],"wp:attachment":[{"href":"https:\/\/citestu17.savecicadabuzz.org\/index.php\/wp-json\/wp\/v2\/media?parent=76"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}