{"id":7798,"date":"2023-10-04T11:22:20","date_gmt":"2023-10-04T19:22:20","guid":{"rendered":"https:\/\/live-cometml.pantheonsite.io\/?p=7798"},"modified":"2025-04-24T17:06:01","modified_gmt":"2025-04-24T17:06:01","slug":"image-compression-using-different-machine-learning-techniques","status":"publish","type":"post","link":"https:\/\/www.comet.com\/site\/blog\/image-compression-using-different-machine-learning-techniques\/","title":{"rendered":"Image Compression Using Different Machine Learning Techniques"},"content":{"rendered":"\n<link rel=\"canonical\" href=\"https:\/\/www.comet.com\/site\/blog\/image-compression-using-different-machine-learning-techniques\">\n\n\n\n<div class=\"fh fi fj fk fl\">\n<div class=\"mf bg\">\n<figure class=\"mg mh mi mj mk mf bg paragraph-image\"><picture><img loading=\"lazy\" decoding=\"async\" class=\"bg ml mm c\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/v2\/resize:fit:2500\/1*9G9qiht3mxEXNOIDZ_swtw.jpeg\" alt=\"\" width=\"2400\" height=\"1633\"><\/picture><figcaption class=\"mn mo mp mq mr ms mt be b bf z dv\" data-selectable-paragraph=\"\">Photo by <a class=\"af mu\" href=\"https:\/\/unsplash.com\/@ellladee?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\" target=\"_blank\" rel=\"noopener ugc nofollow\">N.<\/a> on <a class=\"af mu\" href=\"https:\/\/unsplash.com\/s\/photos\/miniature?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\" target=\"_blank\" rel=\"noopener ugc nofollow\">Unsplash<\/a><\/figcaption><\/figure>\n<\/div>\n<div class=\"ab ca\">\n<div class=\"ch bg et eu ev ew\">\n<p id=\"406b\" class=\"pw-post-body-paragraph mv mw fo be b gm mx my mz gp na nb nc nd ne nf ng nh ni nj nk nl nm nn no np fh bj\" data-selectable-paragraph=\"\">In this post, we\u2019re going to investigate the field of image compression and it\u2019s applications in real world. We\u2019ll explore various machine and deep learning techniques for image compression and inspect their pros and cons, and their practical feasibility in real-world scenarios.<\/p>\n<p id=\"3df0\" class=\"pw-post-body-paragraph mv mw fo be b gm mx my mz gp na nb nc nd ne nf ng nh ni nj nk nl nm nn no np fh bj\" data-selectable-paragraph=\"\"><strong class=\"be nq\"><em class=\"nr\">So let\u2019s get started!<\/em><\/strong><\/p>\n<\/div>\n<\/div>\n<div class=\"mf\">\n<div class=\"ab ca\">\n<div class=\"ns nt nu nv nw nx ce ny cf nz ch bg\">\n<figure class=\"mg mh mi mj mk mf ob oc paragraph-image\">\n<div class=\"od oe eb of bg og\" tabindex=\"0\" role=\"button\">\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"bg ml mm c\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/v2\/resize:fit:1000\/1*Oe9Rul4rOcBgx1aMqM7awA.png\" alt=\"\" width=\"1000\" height=\"467\"><\/figure><div class=\"mq mr oa\"><picture><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/format:webp\/1*Oe9Rul4rOcBgx1aMqM7awA.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/format:webp\/1*Oe9Rul4rOcBgx1aMqM7awA.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/format:webp\/1*Oe9Rul4rOcBgx1aMqM7awA.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/format:webp\/1*Oe9Rul4rOcBgx1aMqM7awA.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/format:webp\/1*Oe9Rul4rOcBgx1aMqM7awA.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/format:webp\/1*Oe9Rul4rOcBgx1aMqM7awA.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:2000\/format:webp\/1*Oe9Rul4rOcBgx1aMqM7awA.png 2000w\" type=\"image\/webp\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 1000px\"><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/1*Oe9Rul4rOcBgx1aMqM7awA.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/1*Oe9Rul4rOcBgx1aMqM7awA.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/1*Oe9Rul4rOcBgx1aMqM7awA.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/1*Oe9Rul4rOcBgx1aMqM7awA.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/1*Oe9Rul4rOcBgx1aMqM7awA.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/1*Oe9Rul4rOcBgx1aMqM7awA.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:2000\/1*Oe9Rul4rOcBgx1aMqM7awA.png 2000w\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 1000px\" data-testid=\"og\"><\/picture><\/div>\n<\/div>\n<figcaption class=\"mn mo mp mq mr ms mt be b bf z dv\" data-selectable-paragraph=\"\"><a class=\"af mu\" href=\"https:\/\/www.lifewire.com\/the-effect-of-compression-on-photographs-493726\" target=\"_blank\" rel=\"noopener ugc nofollow\">Image Source<\/a><\/figcaption>\n<\/figure>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"ab ca\">\n<div class=\"ch bg et eu ev ew\">\n<h1 id=\"fdaf\" class=\"oh oi fo be oj ok ol go om on oo gr op oq or os ot ou ov ow ox oy oz pa pb pc bj\" data-selectable-paragraph=\"\">What is image compression?<\/h1>\n<p id=\"7f3c\" class=\"pw-post-body-paragraph mv mw fo be b gm pd my mz gp pe nb nc nd pf nf ng nh pg nj nk nl ph nn no np fh bj\" data-selectable-paragraph=\"\">Image compression refer to reducing the dimensions, pixels, or color components of an image so as to reduce the cost of storing or performing operations on them. Some image compression techniques also identify the most significant components of an image and discard the rest, resulting in data compression as well.<\/p>\n<p id=\"3b40\" class=\"pw-post-body-paragraph mv mw fo be b gm mx my mz gp na nb nc nd ne nf ng nh ni nj nk nl nm nn no np fh bj\" data-selectable-paragraph=\"\">Image compression can therefore be defined as a data compression approach that reduces the data bits needed to encode an image while preserving image details.<\/p>\n<h1 id=\"2fa5\" class=\"oh oi fo be oj ok ol go om on oo gr op oq or os ot ou ov ow ox oy oz pa pb pc bj\" data-selectable-paragraph=\"\">Why are image compression techniques needed?<\/h1>\n<p id=\"3e12\" class=\"pw-post-body-paragraph mv mw fo be b gm pd my mz gp pe nb nc nd pf nf ng nh pg nj nk nl ph nn no np fh bj\" data-selectable-paragraph=\"\">Listed below are some of the potential applications of image compression:<\/p>\n<ol class=\"\">\n<li id=\"7f2e\" class=\"mv mw fo be b gm mx my mz gp na nb nc nd pi nf ng nh pj nj nk nl pk nn no np pl pm pn bj\" data-selectable-paragraph=\"\">Data takes up lesser storage when compressed. As a result, this allows more data to be stored with less disk space. This is especially useful in healthcare, where medical images need to be archived, and dataset volume is massive.<\/li>\n<li id=\"14d3\" class=\"mv mw fo be b gm po my mz gp pp nb nc nd pq nf ng nh pr nj nk nl ps nn no np pl pm pn bj\" data-selectable-paragraph=\"\">Some image compression techniques involving extracting the most useful components of the image (PCA), which can be used for feature summarization or extraction and data analysis.<\/li>\n<li id=\"e50c\" class=\"mv mw fo be b gm po my mz gp pp nb nc nd pq nf ng nh pr nj nk nl ps nn no np pl pm pn bj\" data-selectable-paragraph=\"\">Federal government or security agencies need to maintain records of people in a pre-determined, standard, and uniform manners. Thus, images from all sources need to be compressed to be of one uniform shape, size, and resolution.<\/li>\n<\/ol>\n<h1 id=\"6ccf\" class=\"oh oi fo be oj ok ol go om on oo gr op oq or os ot ou ov ow ox oy oz pa pb pc bj\" data-selectable-paragraph=\"\">Types of image compression<\/h1>\n<p id=\"6249\" class=\"pw-post-body-paragraph mv mw fo be b gm pd my mz gp pe nb nc nd pf nf ng nh pg nj nk nl ph nn no np fh bj\" data-selectable-paragraph=\"\">Types of image compression can be categorized by their ability to re-create the original image from its compressed form.<\/p>\n<h2 id=\"1863\" class=\"pt oi fo be oj pu pv pw om px py pz op nd qa qb qc nh qd qe qf nl qg qh qi qj bj\" data-selectable-paragraph=\"\">Lossy Compression<\/h2>\n<p id=\"7ef3\" class=\"pw-post-body-paragraph mv mw fo be b gm pd my mz gp pe nb nc nd pf nf ng nh pg nj nk nl ph nn no np fh bj\" data-selectable-paragraph=\"\">Lossy compression, as its name suggests, is a form of data compression that retains useful image details while discarding a few bits in order to reduce its size or to extract important components. Thus, in lossy compression, data is irreversibly lost and the original image cannot be completely re-created.<\/p>\n<figure class=\"mg mh mi mj mk mf mq mr paragraph-image\">\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"bg ml mm c\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/v2\/resize:fit:500\/1*2WYqjOuiSLkchvsBffIxug.png\" alt=\"\" width=\"500\" height=\"207\"><\/figure><div class=\"mq mr qk\"><picture><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/format:webp\/1*2WYqjOuiSLkchvsBffIxug.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/format:webp\/1*2WYqjOuiSLkchvsBffIxug.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/format:webp\/1*2WYqjOuiSLkchvsBffIxug.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/format:webp\/1*2WYqjOuiSLkchvsBffIxug.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/format:webp\/1*2WYqjOuiSLkchvsBffIxug.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/format:webp\/1*2WYqjOuiSLkchvsBffIxug.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1000\/format:webp\/1*2WYqjOuiSLkchvsBffIxug.png 1000w\" type=\"image\/webp\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 500px\"><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/1*2WYqjOuiSLkchvsBffIxug.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/1*2WYqjOuiSLkchvsBffIxug.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/1*2WYqjOuiSLkchvsBffIxug.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/1*2WYqjOuiSLkchvsBffIxug.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/1*2WYqjOuiSLkchvsBffIxug.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/1*2WYqjOuiSLkchvsBffIxug.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1000\/1*2WYqjOuiSLkchvsBffIxug.png 1000w\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 500px\" data-testid=\"og\"><\/picture><\/div>\n<\/figure>\n<h2 id=\"5585\" class=\"pt oi fo be oj pu pv pw om px py pz op nd qa qb qc nh qd qe qf nl qg qh qi qj bj\" data-selectable-paragraph=\"\">Lossless Compression<\/h2>\n<p id=\"9409\" class=\"pw-post-body-paragraph mv mw fo be b gm pd my mz gp pe nb nc nd pf nf ng nh pg nj nk nl ph nn no np fh bj\" data-selectable-paragraph=\"\">Lossless compression is a form of data or image compression under which any sort of data loss is avoided, and thus, compressed images are larger in size. However, the original image can be re-constructed using this kind of image compression.<\/p>\n<\/div>\n<\/div>\n<\/div>\n\n\n\n<div class=\"fh fi fj fk fl\">\n<div class=\"ab ca\">\n<div class=\"ch bg et eu ev ew\">\n<p id=\"82d0\" class=\"pw-post-body-paragraph mv mw fo be b gm mx my mz gp na nb nc nd ne nf ng nh ni nj nk nl nm nn no np fh bj\" data-selectable-paragraph=\"\"><strong class=\"be nq\"><em class=\"nr\">Let\u2019s take a closer look at how we can use machine learning techniques for image compression.<\/em><\/strong><\/p>\n<h1 id=\"fe48\" class=\"oh oi fo be oj ok ol go om on oo gr op oq or os ot ou ov ow ox oy oz pa pb pc bj\" data-selectable-paragraph=\"\">Image Compression using principal component analysis<\/h1>\n<p id=\"d330\" class=\"pw-post-body-paragraph mv mw fo be b gm pd my mz gp pe nb nc nd pf nf ng nh pg nj nk nl ph nn no np fh bj\" data-selectable-paragraph=\"\">Principal component analysis(PCA) is a technique for <em class=\"nr\">feature extraction<\/em> \u2014 so it combines our input variables in a specific way, at which point we can drop the least important variables while still retaining the most valuable parts of all of the variables. PCA results in the development of new features that are independent of one another.<\/p>\n<figure class=\"mg mh mi mj mk mf mq mr paragraph-image\">\n<div class=\"od oe eb of bg og\" tabindex=\"0\" role=\"button\">\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"bg ml mm c\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*8d0wEhjACcJkg84zkQlmVQ.png\" alt=\"\" width=\"700\" height=\"292\"><\/figure><div class=\"mq mr qt\"><picture><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/format:webp\/1*8d0wEhjACcJkg84zkQlmVQ.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/format:webp\/1*8d0wEhjACcJkg84zkQlmVQ.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/format:webp\/1*8d0wEhjACcJkg84zkQlmVQ.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/format:webp\/1*8d0wEhjACcJkg84zkQlmVQ.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/format:webp\/1*8d0wEhjACcJkg84zkQlmVQ.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/format:webp\/1*8d0wEhjACcJkg84zkQlmVQ.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1400\/format:webp\/1*8d0wEhjACcJkg84zkQlmVQ.png 1400w\" type=\"image\/webp\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\"><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/1*8d0wEhjACcJkg84zkQlmVQ.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/1*8d0wEhjACcJkg84zkQlmVQ.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/1*8d0wEhjACcJkg84zkQlmVQ.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/1*8d0wEhjACcJkg84zkQlmVQ.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/1*8d0wEhjACcJkg84zkQlmVQ.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/1*8d0wEhjACcJkg84zkQlmVQ.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1400\/1*8d0wEhjACcJkg84zkQlmVQ.png 1400w\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\" data-testid=\"og\"><\/picture><\/div>\n<\/div>\n<\/figure>\n<p id=\"b88c\" class=\"pw-post-body-paragraph mv mw fo be b gm mx my mz gp na nb nc nd ne nf ng nh ni nj nk nl nm nn no np fh bj\" data-selectable-paragraph=\"\"><strong class=\"be nq\">Briefly listing the steps of PCA below:<\/strong><\/p>\n<ol class=\"\">\n<li id=\"b80e\" class=\"mv mw fo be b gm mx my mz gp na nb nc nd pi nf ng nh pj nj nk nl pk nn no np pl pm pn bj\" data-selectable-paragraph=\"\">Scale the data by subtracting the mean and dividing by std. deviation.<\/li>\n<li id=\"5238\" class=\"mv mw fo be b gm po my mz gp pp nb nc nd pq nf ng nh pr nj nk nl ps nn no np pl pm pn bj\" data-selectable-paragraph=\"\">Compute the <em class=\"nr\">covariance matrix<\/em>.<\/li>\n<li id=\"cd28\" class=\"mv mw fo be b gm po my mz gp pp nb nc nd pq nf ng nh pr nj nk nl ps nn no np pl pm pn bj\" data-selectable-paragraph=\"\">Compute <em class=\"nr\">eigenvectors<\/em> and the corresponding <em class=\"nr\">eigenvalues<\/em>.<\/li>\n<li id=\"6212\" class=\"mv mw fo be b gm po my mz gp pp nb nc nd pq nf ng nh pr nj nk nl ps nn no np pl pm pn bj\" data-selectable-paragraph=\"\">Sort the eigenvectors by decreasing eigenvalues and choose k eigenvectors with the largest eigenvalues, with these becoming the principal components<strong class=\"be nq\">.<\/strong><\/li>\n<li id=\"5ffc\" class=\"mv mw fo be b gm po my mz gp pp nb nc nd pq nf ng nh pr nj nk nl ps nn no np pl pm pn bj\" data-selectable-paragraph=\"\">Derive the new axes by re-orientation of data points according to the principal components.<\/li>\n<\/ol>\n<p id=\"191f\" class=\"pw-post-body-paragraph mv mw fo be b gm mx my mz gp na nb nc nd ne nf ng nh ni nj nk nl nm nn no np fh bj\" data-selectable-paragraph=\"\"><strong class=\"be nq\">To learn more about PCA, please refer to <\/strong><a class=\"af mu\" href=\"https:\/\/heartbeat.comet.ml\/understanding-the-mathematics-behind-principal-component-analysis-efd7c9ff0bb3\" target=\"_blank\" rel=\"noopener ugc nofollow\"><strong class=\"be nq\">this<\/strong><\/a><strong class=\"be nq\"> article.<\/strong><\/p>\n<h2 id=\"750a\" class=\"pt oi fo be oj pu pv pw om px py pz op nd qa qb qc nh qd qe qf nl qg qh qi qj bj\" data-selectable-paragraph=\"\"><strong class=\"al\">Image compression using PCA<\/strong><\/h2>\n<p id=\"6738\" class=\"pw-post-body-paragraph mv mw fo be b gm pd my mz gp pe nb nc nd pf nf ng nh pg nj nk nl ph nn no np fh bj\" data-selectable-paragraph=\"\">The principal components, when sorted in the order of their eigenvalues, preserve most of the information in the dataset within the first principal component, the rest in the second, and so on.<\/p>\n<p id=\"1ed9\" class=\"pw-post-body-paragraph mv mw fo be b gm mx my mz gp na nb nc nd ne nf ng nh ni nj nk nl nm nn no np fh bj\" data-selectable-paragraph=\"\">Thus, we can preserve most of the details in an image by applying PCA. We can detect the number of principal components required to preserve variance by a certain percentage\u2014say, 95% or 98%\u2014and then apply PCA to transform the data space.<\/p>\n<p id=\"6d55\" class=\"pw-post-body-paragraph mv mw fo be b gm mx my mz gp na nb nc nd ne nf ng nh ni nj nk nl nm nn no np fh bj\" data-selectable-paragraph=\"\">All the steps mentioned above will be followed in the same manner, and in the end we can create the compressed image by using this transformed data space.<\/p>\n<p id=\"35cb\" class=\"pw-post-body-paragraph mv mw fo be b gm mx my mz gp na nb nc nd ne nf ng nh ni nj nk nl nm nn no np fh bj\" data-selectable-paragraph=\"\">It\u2019s very space-efficient, since an image with n*m pixels or dimensions (say 28*28=784) can be preserved by a very small number of principal components (just around 20\u201330).<\/p>\n<blockquote class=\"qv qw qx\"><p id=\"0cb2\" class=\"mv mw nr be b gm mx my mz gp na nb nc qy ne nf ng qz ni nj nk ra nm nn no np fh bj\" data-selectable-paragraph=\"\"><strong class=\"be nq\">Note: <\/strong>Although PCA preserves most information, it is still a form of lossy compression since some amount of data is discarded, even if it is a small percentage.<\/p><\/blockquote>\n<h2 id=\"fd34\" class=\"pt oi fo be oj pu pv pw om px py pz op nd qa qb qc nh qd qe qf nl qg qh qi qj bj\" data-selectable-paragraph=\"\"><em><a href=\"https:\/\/github.com\/nikitaa30\/Image-Compression-using-ML-and-Neural-Networks\/blob\/master\/PCA_Compression.py?source=post_page-----5787c88515f8--------------------------------\"><span style=\"text-decoration: underline;\">Source To Get Started<\/span><\/a><\/em><\/h2>\n<\/div>\n<\/div>\n<\/div>\n\n\n\n<div class=\"fh fi fj fk fl\">\n<div class=\"ab ca\">\n<div class=\"ch bg et eu ev ew\">\n<h2 id=\"c44c\" class=\"oh oi fo be oj ok rv go om on rw gr op oq rx os ot ou ry ow ox oy rz pa pb pc bj\">Image compression using k-means clustering<\/h2>\n<p id=\"ffec\" class=\"pw-post-body-paragraph mv mw fo be b gm pd my mz gp pe nb nc nd pf nf ng nh pg nj nk nl ph nn no np fh bj\" data-selectable-paragraph=\"\">K-means clustering is a prototype-based, partitional clustering technique that attempts to \ufb01nd a user-speci\ufb01ed number of clusters (k), which are represented by their centroids.<\/p>\n<figure class=\"mg mh mi mj mk mf mq mr paragraph-image\">\n<div class=\"od oe eb of bg og\" tabindex=\"0\" role=\"button\">\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"bg ml mm c\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*89H2Cky1vytS9Zfa15138A.png\" alt=\"\" width=\"700\" height=\"296\"><\/figure><div class=\"mq mr sa\"><picture><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/format:webp\/1*89H2Cky1vytS9Zfa15138A.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/format:webp\/1*89H2Cky1vytS9Zfa15138A.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/format:webp\/1*89H2Cky1vytS9Zfa15138A.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/format:webp\/1*89H2Cky1vytS9Zfa15138A.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/format:webp\/1*89H2Cky1vytS9Zfa15138A.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/format:webp\/1*89H2Cky1vytS9Zfa15138A.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1400\/format:webp\/1*89H2Cky1vytS9Zfa15138A.png 1400w\" type=\"image\/webp\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\"><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/1*89H2Cky1vytS9Zfa15138A.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/1*89H2Cky1vytS9Zfa15138A.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/1*89H2Cky1vytS9Zfa15138A.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/1*89H2Cky1vytS9Zfa15138A.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/1*89H2Cky1vytS9Zfa15138A.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/1*89H2Cky1vytS9Zfa15138A.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1400\/1*89H2Cky1vytS9Zfa15138A.png 1400w\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\" data-testid=\"og\"><\/picture><\/div>\n<\/div>\n<\/figure>\n<p id=\"a678\" class=\"pw-post-body-paragraph mv mw fo be b gm mx my mz gp na nb nc nd ne nf ng nh ni nj nk nl nm nn no np fh bj\" data-selectable-paragraph=\"\"><strong class=\"be nq\">Briefly listing the steps of k-means clustering below:<\/strong><\/p>\n<ol class=\"\">\n<li id=\"aa73\" class=\"mv mw fo be b gm mx my mz gp na nb nc nd pi nf ng nh pj nj nk nl pk nn no np pl pm pn bj\" data-selectable-paragraph=\"\">We \ufb01rst choose k initial centroids, where k is a user-speci\ufb01ed parameter; namely, the number of clusters desired.<\/li>\n<li id=\"e5e3\" class=\"mv mw fo be b gm po my mz gp pp nb nc nd pq nf ng nh pr nj nk nl ps nn no np pl pm pn bj\" data-selectable-paragraph=\"\">Each point is then assigned to the closest centroid, and each collection of points assigned to a centroid is called a cluster.<\/li>\n<li id=\"ca0d\" class=\"mv mw fo be b gm po my mz gp pp nb nc nd pq nf ng nh pr nj nk nl ps nn no np pl pm pn bj\" data-selectable-paragraph=\"\">The centroid of each cluster is then updated based on the points assigned to the cluster.<\/li>\n<li id=\"40f1\" class=\"mv mw fo be b gm po my mz gp pp nb nc nd pq nf ng nh pr nj nk nl ps nn no np pl pm pn bj\" data-selectable-paragraph=\"\">We repeat the assignment and update steps until no point changes clusters, or similarly, until the centroids remain the same.<\/li>\n<\/ol>\n<p id=\"1fa2\" class=\"pw-post-body-paragraph mv mw fo be b gm mx my mz gp na nb nc nd ne nf ng nh ni nj nk nl nm nn no np fh bj\" data-selectable-paragraph=\"\"><strong class=\"be nq\">To learn more about k-means clustering, please refer to <\/strong><a class=\"af mu\" href=\"https:\/\/heartbeat.comet.ml\/understanding-the-mathematics-behind-k-means-clustering-40e1d55e2f4c\" target=\"_blank\" rel=\"noopener ugc nofollow\"><strong class=\"be nq\">this<\/strong><\/a><strong class=\"be nq\"> article.<\/strong><\/p>\n<h2 id=\"f468\" class=\"pt oi fo be oj pu pv pw om px py pz op nd qa qb qc nh qd qe qf nl qg qh qi qj bj\" data-selectable-paragraph=\"\"><strong class=\"al\">Image compression using k-means clustering<\/strong><\/h2>\n<p id=\"02b1\" class=\"pw-post-body-paragraph mv mw fo be b gm pd my mz gp pe nb nc nd pf nf ng nh pg nj nk nl ph nn no np fh bj\" data-selectable-paragraph=\"\">As discussed earlier in this post, image compression, in some techniques, involves reducing the color components of the image. With k-means clustering, this is what we\u2019re doing.<\/p>\n<p id=\"6b19\" class=\"pw-post-body-paragraph mv mw fo be b gm mx my mz gp na nb nc nd ne nf ng nh ni nj nk nl nm nn no np fh bj\" data-selectable-paragraph=\"\">We pre-define the value of k as the number of color components that we want to preserve in the image. The rest of the k-means algorithm is performed according to the above-mentioned steps.<\/p>\n<p id=\"b7e5\" class=\"pw-post-body-paragraph mv mw fo be b gm mx my mz gp na nb nc nd ne nf ng nh ni nj nk nl nm nn no np fh bj\" data-selectable-paragraph=\"\">With an increase in the value of k, as the number of clusters increases, the image will get closer and closer to the original image, but at the cost of more disk space for storage and a higher computational cost. We can experiment with the values of k to get desirable results.<\/p>\n<p id=\"42e7\" class=\"pw-post-body-paragraph mv mw fo be b gm mx my mz gp na nb nc nd ne nf ng nh ni nj nk nl nm nn no np fh bj\" data-selectable-paragraph=\"\">We can also calculate the within-cluster sum of squared error to gain insight on whether the clusters are well fitted and correctly assigned or not, since it provides us with the variance of the cluster centroids.<\/p>\n<blockquote class=\"qv qw qx\"><p id=\"bab9\" class=\"mv mw nr be b gm mx my mz gp na nb nc qy ne nf ng qz ni nj nk ra nm nn no np fh bj\" data-selectable-paragraph=\"\"><strong class=\"be nq\">Note: <\/strong>It\u2019s advised to keep the value of k as a multiple (more preferably, a power) of 2, same as the conventional image formats, to get better results.<\/p><\/blockquote>\n<h2 id=\"2138\" class=\"pt oi fo be oj pu pv pw om px py pz op nd qa qb qc nh qd qe qf nl qg qh qi qj bj\" data-selectable-paragraph=\"\"><em><a href=\"https:\/\/github.com\/nikitaa30\/Image-Compression-using-ML-and-Neural-Networks\/blob\/master\/k-means-compression.py?source=post_page-----5787c88515f8--------------------------------\"><span style=\"text-decoration: underline;\">Source To Get Started<\/span><\/a><\/em><\/h2>\n<h1 id=\"c292\" class=\"oh oi fo be oj ok ol go om on oo gr op oq or os ot ou ov ow ox oy oz pa pb pc bj\" data-selectable-paragraph=\"\">Image compression using GANs<\/h1>\n<p id=\"be5d\" class=\"pw-post-body-paragraph mv mw fo be b gm pd my mz gp pe nb nc nd pf nf ng nh pg nj nk nl ph nn no np fh bj\" data-selectable-paragraph=\"\">In generative adversarial networks, two networks train and compete against each other, resulting in mutual improvisation. The generator misleads the discriminator by creating compelling fake inputs and tries to fool the discriminator into thinking of these as real inputs . The discriminator tells if an input is real or fake.<\/p>\n<figure class=\"mg mh mi mj mk mf mq mr paragraph-image\">\n<div class=\"od oe eb of bg og\" tabindex=\"0\" role=\"button\">\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"bg ml mm c\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*Yyjl_tgHRLNGxUM-b48udw.jpeg\" alt=\"\" width=\"700\" height=\"390\"><\/figure><div class=\"mq mr sc\"><picture><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/format:webp\/1*Yyjl_tgHRLNGxUM-b48udw.jpeg 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/format:webp\/1*Yyjl_tgHRLNGxUM-b48udw.jpeg 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/format:webp\/1*Yyjl_tgHRLNGxUM-b48udw.jpeg 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/format:webp\/1*Yyjl_tgHRLNGxUM-b48udw.jpeg 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/format:webp\/1*Yyjl_tgHRLNGxUM-b48udw.jpeg 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/format:webp\/1*Yyjl_tgHRLNGxUM-b48udw.jpeg 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1400\/format:webp\/1*Yyjl_tgHRLNGxUM-b48udw.jpeg 1400w\" type=\"image\/webp\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\"><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/1*Yyjl_tgHRLNGxUM-b48udw.jpeg 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/1*Yyjl_tgHRLNGxUM-b48udw.jpeg 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/1*Yyjl_tgHRLNGxUM-b48udw.jpeg 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/1*Yyjl_tgHRLNGxUM-b48udw.jpeg 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/1*Yyjl_tgHRLNGxUM-b48udw.jpeg 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/1*Yyjl_tgHRLNGxUM-b48udw.jpeg 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1400\/1*Yyjl_tgHRLNGxUM-b48udw.jpeg 1400w\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\" data-testid=\"og\"><\/picture><\/div>\n<\/div>\n<\/figure>\n<p id=\"acdc\" class=\"pw-post-body-paragraph mv mw fo be b gm mx my mz gp na nb nc nd ne nf ng nh ni nj nk nl nm nn no np fh bj\" data-selectable-paragraph=\"\">There are <strong class=\"be nq\">3 major steps <\/strong>in the training of a GAN:<\/p>\n<ol class=\"\">\n<li id=\"9930\" class=\"mv mw fo be b gm mx my mz gp na nb nc nd pi nf ng nh pj nj nk nl pk nn no np pl pm pn bj\" data-selectable-paragraph=\"\">Using the generator to <strong class=\"be nq\">create fake inputs<\/strong> based on random noise, or in our case, random normal noise.<\/li>\n<li id=\"541d\" class=\"mv mw fo be b gm po my mz gp pp nb nc nd pq nf ng nh pr nj nk nl ps nn no np pl pm pn bj\" data-selectable-paragraph=\"\"><strong class=\"be nq\">Training the discriminator<\/strong> with both real and fake inputs (either simultaneously by concatenating real and fake inputs, or one after the other, the latter being preferred).<\/li>\n<li id=\"60eb\" class=\"mv mw fo be b gm po my mz gp pp nb nc nd pq nf ng nh pr nj nk nl ps nn no np pl pm pn bj\" data-selectable-paragraph=\"\"><strong class=\"be nq\">Train the whole model: <\/strong>the model is built with the discriminator combined with the generator.<\/li>\n<\/ol>\n<p id=\"34ce\" class=\"pw-post-body-paragraph mv mw fo be b gm mx my mz gp na nb nc nd ne nf ng nh ni nj nk nl nm nn no np fh bj\" data-selectable-paragraph=\"\"><strong class=\"be nq\">To learn more about GANs, please refer to <\/strong><a class=\"af mu\" href=\"https:\/\/heartbeat.comet.ml\/my-mangagan-building-my-first-generative-adversarial-network-2ec1920257e3\" target=\"_blank\" rel=\"noopener ugc nofollow\"><strong class=\"be nq\">this<\/strong><\/a><strong class=\"be nq\"> article.<\/strong><\/p>\n<h2 id=\"2457\" class=\"pt oi fo be oj pu pv pw om px py pz op nd qa qb qc nh qd qe qf nl qg qh qi qj bj\" data-selectable-paragraph=\"\">Conditional GANs (CGAN)<\/h2>\n<p id=\"2114\" class=\"pw-post-body-paragraph mv mw fo be b gm pd my mz gp pe nb nc nd pf nf ng nh pg nj nk nl ph nn no np fh bj\" data-selectable-paragraph=\"\">Conditional GANs are slightly different from traditional GANs. In a conventional GAN, the output images have no bound; that is, there is no way to determine what the generator would produce.<\/p>\n<p id=\"f76e\" class=\"pw-post-body-paragraph mv mw fo be b gm mx my mz gp na nb nc nd ne nf ng nh ni nj nk nl nm nn no np fh bj\" data-selectable-paragraph=\"\">But in conditional GANs, along with the images as input, additional information is provided as input to the generator and discriminator so that the produced output would be in accordance with the additional information.<\/p>\n<p id=\"137e\" class=\"pw-post-body-paragraph mv mw fo be b gm mx my mz gp na nb nc nd ne nf ng nh ni nj nk nl nm nn no np fh bj\" data-selectable-paragraph=\"\">For example, while generating new handwritten digits with a GAN, a network that\u2019s trained on the MNIST dataset will produce random digits\u2014there\u2019s no way to track its output or predict which digit the generator produces next.<\/p>\n<p id=\"3220\" class=\"pw-post-body-paragraph mv mw fo be b gm mx my mz gp na nb nc nd ne nf ng nh ni nj nk nl nm nn no np fh bj\" data-selectable-paragraph=\"\">However, in CGANs, we can provide the image and the class label (one hot encoded vector informing which digit the image corresponds to) as an input to the generator as well as the discriminator. Thus, our model would be conditioned on class labels. Therefore, this additional information helps the generator produce digits.<\/p>\n<figure class=\"mg mh mi mj mk mf mq mr paragraph-image\">\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"bg ml mm c\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/v2\/resize:fit:483\/1*ZCCgkfcH4cWKCW3hn_5-Ow.png\" alt=\"\" width=\"483\" height=\"83\"><\/figure><div class=\"mq mr sd\"><picture><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/format:webp\/1*ZCCgkfcH4cWKCW3hn_5-Ow.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/format:webp\/1*ZCCgkfcH4cWKCW3hn_5-Ow.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/format:webp\/1*ZCCgkfcH4cWKCW3hn_5-Ow.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/format:webp\/1*ZCCgkfcH4cWKCW3hn_5-Ow.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/format:webp\/1*ZCCgkfcH4cWKCW3hn_5-Ow.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/format:webp\/1*ZCCgkfcH4cWKCW3hn_5-Ow.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:966\/format:webp\/1*ZCCgkfcH4cWKCW3hn_5-Ow.png 966w\" type=\"image\/webp\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 483px\"><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/1*ZCCgkfcH4cWKCW3hn_5-Ow.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/1*ZCCgkfcH4cWKCW3hn_5-Ow.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/1*ZCCgkfcH4cWKCW3hn_5-Ow.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/1*ZCCgkfcH4cWKCW3hn_5-Ow.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/1*ZCCgkfcH4cWKCW3hn_5-Ow.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/1*ZCCgkfcH4cWKCW3hn_5-Ow.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:966\/1*ZCCgkfcH4cWKCW3hn_5-Ow.png 966w\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 483px\" data-testid=\"og\"><\/picture><\/div>\n<\/figure>\n<p id=\"b22f\" class=\"pw-post-body-paragraph mv mw fo be b gm mx my mz gp na nb nc nd ne nf ng nh ni nj nk nl nm nn no np fh bj\" data-selectable-paragraph=\"\">We start with the assumption that s(additional information) is given and that we want to use the GAN to model the conditional distribution Px|s. In this case, both the generator G(z,s) and discriminator D(z,s) have access to the side information s, leading to the divergence<\/p>\n<figure class=\"mg mh mi mj mk mf mq mr paragraph-image\">\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"bg ml mm c\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/v2\/resize:fit:564\/1*2cHgN7d048mMJDS1S9t5qA.png\" alt=\"\" width=\"564\" height=\"66\"><\/figure><div class=\"mq mr se\"><picture><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/format:webp\/1*2cHgN7d048mMJDS1S9t5qA.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/format:webp\/1*2cHgN7d048mMJDS1S9t5qA.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/format:webp\/1*2cHgN7d048mMJDS1S9t5qA.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/format:webp\/1*2cHgN7d048mMJDS1S9t5qA.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/format:webp\/1*2cHgN7d048mMJDS1S9t5qA.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/format:webp\/1*2cHgN7d048mMJDS1S9t5qA.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1128\/format:webp\/1*2cHgN7d048mMJDS1S9t5qA.png 1128w\" type=\"image\/webp\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 564px\"><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/1*2cHgN7d048mMJDS1S9t5qA.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/1*2cHgN7d048mMJDS1S9t5qA.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/1*2cHgN7d048mMJDS1S9t5qA.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/1*2cHgN7d048mMJDS1S9t5qA.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/1*2cHgN7d048mMJDS1S9t5qA.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/1*2cHgN7d048mMJDS1S9t5qA.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1128\/1*2cHgN7d048mMJDS1S9t5qA.png 1128w\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 564px\" data-testid=\"og\"><\/picture><\/div>\n<\/figure>\n<figure class=\"mg mh mi mj mk mf mq mr paragraph-image\">\n<div class=\"od oe eb of bg og\" tabindex=\"0\" role=\"button\">\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"bg ml mm c\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*jnQZOJY6O728zMUVNodPoA.png\" alt=\"\" width=\"700\" height=\"246\"><\/figure><div class=\"mq mr sf\"><picture><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/format:webp\/1*jnQZOJY6O728zMUVNodPoA.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/format:webp\/1*jnQZOJY6O728zMUVNodPoA.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/format:webp\/1*jnQZOJY6O728zMUVNodPoA.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/format:webp\/1*jnQZOJY6O728zMUVNodPoA.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/format:webp\/1*jnQZOJY6O728zMUVNodPoA.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/format:webp\/1*jnQZOJY6O728zMUVNodPoA.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1400\/format:webp\/1*jnQZOJY6O728zMUVNodPoA.png 1400w\" type=\"image\/webp\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\"><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/1*jnQZOJY6O728zMUVNodPoA.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/1*jnQZOJY6O728zMUVNodPoA.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/1*jnQZOJY6O728zMUVNodPoA.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/1*jnQZOJY6O728zMUVNodPoA.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/1*jnQZOJY6O728zMUVNodPoA.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/1*jnQZOJY6O728zMUVNodPoA.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1400\/1*jnQZOJY6O728zMUVNodPoA.png 1400w\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\" data-testid=\"og\"><\/picture><\/div>\n<\/div>\n<\/figure>\n<h2 id=\"fc6b\" class=\"pt oi fo be oj pu pv pw om px py pz op nd qa qb qc nh qd qe qf nl qg qh qi qj bj\" data-selectable-paragraph=\"\"><strong class=\"al\">Image compression using GANs<\/strong><\/h2>\n<p id=\"b5a5\" class=\"pw-post-body-paragraph mv mw fo be b gm pd my mz gp pe nb nc nd pf nf ng nh pg nj nk nl ph nn no np fh bj\" data-selectable-paragraph=\"\">The CGAN is used similarly to an encoder-decoder model, such that the encoder encrypts the information in the image in a latent map by compressing the image and limiting the number of color components, and then this map is used by the decoder (generator) to develop a compressed image according to the information provided.<\/p>\n<p id=\"f4c2\" class=\"pw-post-body-paragraph mv mw fo be b gm mx my mz gp na nb nc nd ne nf ng nh ni nj nk nl nm nn no np fh bj\" data-selectable-paragraph=\"\">With the help of an encoder E and a quantized value q, we encode the image i to get a compressed representation of the image as w = q(E(i)). The decoder\/generator G then tries to generate an image i= G(z) that\u2019s consistent with the image distribution Px and also resembles the original image to a certain degree.<\/p>\n<figure class=\"mg mh mi mj mk mf mq mr paragraph-image\">\n<div class=\"od oe eb of bg og\" tabindex=\"0\" role=\"button\">\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"bg ml mm c\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*Cyt9qd0kaayMt8ljlm99aA.png\" alt=\"\" width=\"700\" height=\"220\"><\/figure><div class=\"mq mr sg\"><picture><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/format:webp\/1*Cyt9qd0kaayMt8ljlm99aA.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/format:webp\/1*Cyt9qd0kaayMt8ljlm99aA.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/format:webp\/1*Cyt9qd0kaayMt8ljlm99aA.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/format:webp\/1*Cyt9qd0kaayMt8ljlm99aA.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/format:webp\/1*Cyt9qd0kaayMt8ljlm99aA.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/format:webp\/1*Cyt9qd0kaayMt8ljlm99aA.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1400\/format:webp\/1*Cyt9qd0kaayMt8ljlm99aA.png 1400w\" type=\"image\/webp\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\"><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/1*Cyt9qd0kaayMt8ljlm99aA.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/1*Cyt9qd0kaayMt8ljlm99aA.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/1*Cyt9qd0kaayMt8ljlm99aA.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/1*Cyt9qd0kaayMt8ljlm99aA.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/1*Cyt9qd0kaayMt8ljlm99aA.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/1*Cyt9qd0kaayMt8ljlm99aA.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1400\/1*Cyt9qd0kaayMt8ljlm99aA.png 1400w\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\" data-testid=\"og\"><\/picture><\/div>\n<\/div>\n<\/figure>\n<h2 id=\"67c7\" class=\"pt oi fo be oj pu pv pw om px py pz op nd qa qb qc nh qd qe qf nl qg qh qi qj bj\" data-selectable-paragraph=\"\">Source to get started:<\/h2>\n<p id=\"5427\" class=\"pw-post-body-paragraph mv mw fo be b gm pd my mz gp pe nb nc nd pf nf ng nh pg nj nk nl ph nn no np fh bj\" data-selectable-paragraph=\"\"><a class=\"af mu\" href=\"https:\/\/arxiv.org\/abs\/1804.02958\" target=\"_blank\" rel=\"noopener ugc nofollow\">Here<\/a> is a detailed and thorough research paper that discusses using CGAN for the task of image compression. It\u2019s well written and I highly recommend you to give it a try to gain better insights on generative compression.<\/p>\n<h1 id=\"5d07\" class=\"oh oi fo be oj ok ol go om on oo gr op oq or os ot ou ov ow ox oy oz pa pb pc bj\" data-selectable-paragraph=\"\">Conclusion<\/h1>\n<p id=\"6253\" class=\"pw-post-body-paragraph mv mw fo be b gm pd my mz gp pe nb nc nd pf nf ng nh pg nj nk nl ph nn no np fh bj\" data-selectable-paragraph=\"\">In this post, we addressed the real-world problem of image compression. Compressed images enhance the efficiency of data storage and transfer. Additionally, we discussed how we can apply various machine learning algorithms and deep neural nets to perform the task with ease.<\/p>\n<p id=\"f3b1\" class=\"pw-post-body-paragraph mv mw fo be b gm mx my mz gp na nb nc nd ne nf ng nh ni nj nk nl nm nn no np fh bj\" data-selectable-paragraph=\"\">This post contains references to my previous posts on<a class=\"af mu\" href=\"https:\/\/heartbeat.comet.ml\/understanding-the-mathematics-behind-principal-component-analysis-efd7c9ff0bb3\" target=\"_blank\" rel=\"noopener ugc nofollow\"> PCA<\/a>, <a class=\"af mu\" href=\"https:\/\/heartbeat.comet.ml\/understanding-the-mathematics-behind-k-means-clustering-40e1d55e2f4c\" target=\"_blank\" rel=\"noopener ugc nofollow\">k-means clustering<\/a> and <a class=\"af mu\" href=\"https:\/\/heartbeat.comet.ml\/my-mangagan-building-my-first-generative-adversarial-network-2ec1920257e3\" target=\"_blank\" rel=\"noopener ugc nofollow\">GANs<\/a>. I recommend reading those as well to get a better understanding of their applications here.<\/p>\n<p id=\"47b1\" class=\"pw-post-body-paragraph mv mw fo be b gm mx my mz gp na nb nc nd ne nf ng nh ni nj nk nl nm nn no np fh bj\" data-selectable-paragraph=\"\">All feedback is welcome and appreciated\u2014I\u2019d love to hear what you think of this article.<\/p>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Photo by N. on Unsplash In this post, we\u2019re going to investigate the field of image compression and it\u2019s applications in real world. We\u2019ll explore various machine and deep learning techniques for image compression and inspect their pros and cons, and their practical feasibility in real-world scenarios. So let\u2019s get started! Image Source What is [&hellip;]<\/p>\n","protected":false},"author":36,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"customer_name":"","customer_description":"","customer_industry":"","customer_technologies":"","customer_logo":"","footnotes":""},"categories":[6,7],"tags":[],"coauthors":[114],"class_list":["post-7798","post","type-post","status-publish","format-standard","hentry","category-machine-learning","category-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v25.9) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Image Compression Using Different Machine Learning Techniques - Comet<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.comet.com\/site\/blog\/image-compression-using-different-machine-learning-techniques\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Image Compression Using Different Machine Learning Techniques\" \/>\n<meta property=\"og:description\" content=\"Photo by N. on Unsplash In this post, we\u2019re going to investigate the field of image compression and it\u2019s applications in real world. We\u2019ll explore various machine and deep learning techniques for image compression and inspect their pros and cons, and their practical feasibility in real-world scenarios. So let\u2019s get started! Image Source What is [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.comet.com\/site\/blog\/image-compression-using-different-machine-learning-techniques\/\" \/>\n<meta property=\"og:site_name\" content=\"Comet\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/cometdotml\" \/>\n<meta property=\"article:published_time\" content=\"2023-10-04T19:22:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-24T17:06:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/miro.medium.com\/v2\/resize:fit:2500\/1*9G9qiht3mxEXNOIDZ_swtw.jpeg\" \/>\n<meta name=\"author\" content=\"Nikita Sharma\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@Cometml\" \/>\n<meta name=\"twitter:site\" content=\"@Cometml\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nikita Sharma\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Image Compression Using Different Machine Learning Techniques - Comet","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.comet.com\/site\/blog\/image-compression-using-different-machine-learning-techniques\/","og_locale":"en_US","og_type":"article","og_title":"Image Compression Using Different Machine Learning Techniques","og_description":"Photo by N. on Unsplash In this post, we\u2019re going to investigate the field of image compression and it\u2019s applications in real world. We\u2019ll explore various machine and deep learning techniques for image compression and inspect their pros and cons, and their practical feasibility in real-world scenarios. So let\u2019s get started! Image Source What is [&hellip;]","og_url":"https:\/\/www.comet.com\/site\/blog\/image-compression-using-different-machine-learning-techniques\/","og_site_name":"Comet","article_publisher":"https:\/\/www.facebook.com\/cometdotml","article_published_time":"2023-10-04T19:22:20+00:00","article_modified_time":"2025-04-24T17:06:01+00:00","og_image":[{"url":"https:\/\/miro.medium.com\/v2\/resize:fit:2500\/1*9G9qiht3mxEXNOIDZ_swtw.jpeg","type":"","width":"","height":""}],"author":"Nikita Sharma","twitter_card":"summary_large_image","twitter_creator":"@Cometml","twitter_site":"@Cometml","twitter_misc":{"Written by":"Nikita Sharma","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.comet.com\/site\/blog\/image-compression-using-different-machine-learning-techniques\/#article","isPartOf":{"@id":"https:\/\/www.comet.com\/site\/blog\/image-compression-using-different-machine-learning-techniques\/"},"author":{"name":"Nikita Sharma","@id":"https:\/\/www.comet.com\/site\/#\/schema\/person\/ddaf0d52f59c3a234abfa717ee44af05"},"headline":"Image Compression Using Different Machine Learning Techniques","datePublished":"2023-10-04T19:22:20+00:00","dateModified":"2025-04-24T17:06:01+00:00","mainEntityOfPage":{"@id":"https:\/\/www.comet.com\/site\/blog\/image-compression-using-different-machine-learning-techniques\/"},"wordCount":1598,"publisher":{"@id":"https:\/\/www.comet.com\/site\/#organization"},"image":{"@id":"https:\/\/www.comet.com\/site\/blog\/image-compression-using-different-machine-learning-techniques\/#primaryimage"},"thumbnailUrl":"https:\/\/miro.medium.com\/v2\/resize:fit:2500\/1*9G9qiht3mxEXNOIDZ_swtw.jpeg","articleSection":["Machine Learning","Tutorials"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.comet.com\/site\/blog\/image-compression-using-different-machine-learning-techniques\/","url":"https:\/\/www.comet.com\/site\/blog\/image-compression-using-different-machine-learning-techniques\/","name":"Image Compression Using Different Machine Learning Techniques - Comet","isPartOf":{"@id":"https:\/\/www.comet.com\/site\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.comet.com\/site\/blog\/image-compression-using-different-machine-learning-techniques\/#primaryimage"},"image":{"@id":"https:\/\/www.comet.com\/site\/blog\/image-compression-using-different-machine-learning-techniques\/#primaryimage"},"thumbnailUrl":"https:\/\/miro.medium.com\/v2\/resize:fit:2500\/1*9G9qiht3mxEXNOIDZ_swtw.jpeg","datePublished":"2023-10-04T19:22:20+00:00","dateModified":"2025-04-24T17:06:01+00:00","breadcrumb":{"@id":"https:\/\/www.comet.com\/site\/blog\/image-compression-using-different-machine-learning-techniques\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.comet.com\/site\/blog\/image-compression-using-different-machine-learning-techniques\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.comet.com\/site\/blog\/image-compression-using-different-machine-learning-techniques\/#primaryimage","url":"https:\/\/miro.medium.com\/v2\/resize:fit:2500\/1*9G9qiht3mxEXNOIDZ_swtw.jpeg","contentUrl":"https:\/\/miro.medium.com\/v2\/resize:fit:2500\/1*9G9qiht3mxEXNOIDZ_swtw.jpeg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.comet.com\/site\/blog\/image-compression-using-different-machine-learning-techniques\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.comet.com\/site\/"},{"@type":"ListItem","position":2,"name":"Image Compression Using Different Machine Learning Techniques"}]},{"@type":"WebSite","@id":"https:\/\/www.comet.com\/site\/#website","url":"https:\/\/www.comet.com\/site\/","name":"Comet","description":"Build Better Models Faster","publisher":{"@id":"https:\/\/www.comet.com\/site\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.comet.com\/site\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.comet.com\/site\/#organization","name":"Comet ML, Inc.","alternateName":"Comet","url":"https:\/\/www.comet.com\/site\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.comet.com\/site\/#\/schema\/logo\/image\/","url":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2025\/01\/logo_comet_square.png","contentUrl":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2025\/01\/logo_comet_square.png","width":310,"height":310,"caption":"Comet ML, Inc."},"image":{"@id":"https:\/\/www.comet.com\/site\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/cometdotml","https:\/\/x.com\/Cometml","https:\/\/www.youtube.com\/channel\/UCmN63HKvfXSCS-UwVwmK8Hw"]},{"@type":"Person","@id":"https:\/\/www.comet.com\/site\/#\/schema\/person\/ddaf0d52f59c3a234abfa717ee44af05","name":"Nikita Sharma","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.comet.com\/site\/#\/schema\/person\/image\/19634f9b328196b88e91a242ab1b3576","url":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2023\/08\/1688123806627-96x96.jpg","contentUrl":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2023\/08\/1688123806627-96x96.jpg","caption":"Nikita Sharma"},"url":"https:\/\/www.comet.com\/site\/blog\/author\/nikitasharma\/"}]}},"_links":{"self":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts\/7798","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/users\/36"}],"replies":[{"embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/comments?post=7798"}],"version-history":[{"count":1,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts\/7798\/revisions"}],"predecessor-version":[{"id":15519,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts\/7798\/revisions\/15519"}],"wp:attachment":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/media?parent=7798"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/categories?post=7798"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/tags?post=7798"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/coauthors?post=7798"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}