{"id":860,"date":"2025-07-07T21:45:53","date_gmt":"2025-07-07T21:45:53","guid":{"rendered":"https:\/\/cristianku.com\/?p=860"},"modified":"2025-07-07T21:55:08","modified_gmt":"2025-07-07T21:55:08","slug":"deep-learning-training-with-huge-amount-of-data-part2","status":"publish","type":"post","link":"https:\/\/cristianku.com\/it\/2025\/07\/07\/deep-learning-training-with-huge-amount-of-data-part2\/","title":{"rendered":"Deep Learning . Training with huge amount of data .PART2"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"860\" class=\"elementor elementor-860\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-1e6ea64 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"1e6ea64\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-ba0fa1f\" data-id=\"ba0fa1f\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-dae4295 elementor-widget elementor-widget-text-editor\" data-id=\"dae4295\" data-element_type=\"widget\" data-e-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\t\t<p id=\"af82\" class=\"pw-post-body-paragraph mi mj fr mk b ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf fk bk\" data-selectable-paragraph=\"\">If you read the first part we left at the point that we are goint to build a multi-thread, multiprocesses mechanism.<\/p><p id=\"2700\" class=\"pw-post-body-paragraph mi mj fr mk b ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf fk bk\" data-selectable-paragraph=\"\"><strong class=\"mk fs\">CPU1: <\/strong>reads a big chunk from disk ( 3200 samples ), shuffle it, and insert a memory Buffer ( Queue)<\/p><p id=\"f751\" class=\"pw-post-body-paragraph mi mj fr mk b ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf fk bk\" data-selectable-paragraph=\"\"><strong class=\"mk fs\">CPU2: <\/strong>the second one is the <strong class=\"mk fs\">generator <\/strong>that extract a small amount from this buffer ( the batch size = 32 samples)<\/p><p id=\"a141\" class=\"pw-post-body-paragraph mi mj fr mk b ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf fk bk\" data-selectable-paragraph=\"\">GPU: last one is the Keras\/Tensorflow calculations done in the <strong class=\"mk fs\">GPU<\/strong><\/p><p class=\"pw-post-body-paragraph mi mj fr mk b ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf fk bk\" data-selectable-paragraph=\"\"><strong class=\"mk fs\">For this purpose we do use the Python Queue:<\/strong><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-9c4f7f6 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"9c4f7f6\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-12504f7\" data-id=\"12504f7\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-4b1142c elementor-widget elementor-widget-kerge-quote\" data-id=\"4b1142c\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"kerge-quote.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<blockquote class=\"quote\">\r\n\t\t    The Queue module implements multi-producer, multi-consumer queues.\nIt is especially useful in threaded programming when information must be exchanged safely between multiple threads.\nThe Queue class in this module implements all the required locking semantics.\nIt depends on the availability of thread support in Python; see the threading module.\t\t\t\t\t<\/blockquote>\r\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a2d6e31 elementor-widget elementor-widget-text-editor\" data-id=\"a2d6e31\" data-element_type=\"widget\" data-e-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\t\t<p id=\"205d\" class=\"pw-post-body-paragraph mi mj fr mk b ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf fk bk\" data-selectable-paragraph=\"\">Let\u2019s define the queues:<\/p><figure class=\"nv nw nx ny nz oa of og paragraph-image\"><\/figure>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d71ba9d elementor-widget elementor-widget-image\" data-id=\"d71ba9d\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img fetchpriority=\"high\" decoding=\"async\" width=\"500\" height=\"148\" src=\"https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1ObY9VAJJHjTLrt2GoHy2kQ.webp\" class=\"attachment-large size-large wp-image-868\" alt=\"\" srcset=\"https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1ObY9VAJJHjTLrt2GoHy2kQ.webp 500w, https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1ObY9VAJJHjTLrt2GoHy2kQ-300x89.webp 300w, https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1ObY9VAJJHjTLrt2GoHy2kQ-18x5.webp 18w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4d45e11 elementor-widget elementor-widget-text-editor\" data-id=\"4d45e11\" data-element_type=\"widget\" data-e-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\t\t<p id=\"7a27\" class=\"pw-post-body-paragraph mi mj fr mk b ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf fk bk\" data-selectable-paragraph=\"\">One important thing to note about the <strong class=\"mk fs\">Python Queue <\/strong>, is , that defining the <em class=\"ng\">max size<\/em>, we can decide <strong class=\"mk fs\">HOW MANY IMAGES<\/strong>, put in memory.<\/p><p id=\"865e\" class=\"pw-post-body-paragraph mi mj fr mk b ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf fk bk\" data-selectable-paragraph=\"\">And the instruction <strong class=\"mk fs\">&lt;Queue name&gt;.put<\/strong> will put data until the Queue is full and then wait until the Queue will be have free space.<\/p><p id=\"ec04\" class=\"pw-post-body-paragraph mi mj fr mk b ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf fk bk\" data-selectable-paragraph=\"\">In our case the put method will be wait for Tensorflow to get the data<\/p><p id=\"1fe1\" class=\"pw-post-body-paragraph mi mj fr mk b ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf fk bk\" data-selectable-paragraph=\"\">First we need a Function that can be put in a threaded process :<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-22099dc elementor-widget elementor-widget-image\" data-id=\"22099dc\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"794\" height=\"379\" data-src=\"https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1ljNfe5Y1N26e_arw24QoOA.webp\" class=\"attachment-large size-large wp-image-869 lazyload\" alt=\"\" data-srcset=\"https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1ljNfe5Y1N26e_arw24QoOA.webp 794w, https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1ljNfe5Y1N26e_arw24QoOA-300x143.webp 300w, https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1ljNfe5Y1N26e_arw24QoOA-768x367.webp 768w, https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1ljNfe5Y1N26e_arw24QoOA-18x9.webp 18w\" data-sizes=\"(max-width: 794px) 100vw, 794px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 794px; --smush-placeholder-aspect-ratio: 794\/379;\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-573acf3 elementor-widget elementor-widget-text-editor\" data-id=\"573acf3\" data-element_type=\"widget\" data-e-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\t\t<p id=\"1f72\" class=\"pw-post-body-paragraph mi mj fr mk b ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf fk bk\" data-selectable-paragraph=\"\">And the generator function will become now very short :<\/p><figure class=\"nv nw nx ny nz oa of og paragraph-image\"><\/figure>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a469c88 elementor-widget elementor-widget-image\" data-id=\"a469c88\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"641\" height=\"314\" data-src=\"https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/11DKTVmyCmIgdZ_MwigmrQQ.webp\" class=\"attachment-large size-large wp-image-870 lazyload\" alt=\"\" data-srcset=\"https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/11DKTVmyCmIgdZ_MwigmrQQ.webp 641w, https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/11DKTVmyCmIgdZ_MwigmrQQ-300x147.webp 300w, https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/11DKTVmyCmIgdZ_MwigmrQQ-18x9.webp 18w\" data-sizes=\"(max-width: 641px) 100vw, 641px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 641px; --smush-placeholder-aspect-ratio: 641\/314;\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-abf84fd elementor-widget elementor-widget-text-editor\" data-id=\"abf84fd\" data-element_type=\"widget\" data-e-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\t\t<p id=\"b314\" class=\"pw-post-body-paragraph mi mj fr mk b ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf fk bk\" data-selectable-paragraph=\"\">This because the dirty work is done by the Queue loader \u2192 <strong class=\"mk fs\">read_images_into_queue. <\/strong>In the generator we need only to send back to Tensorflow that Samples, as many as the <strong class=\"mk fs\">batch_size<\/strong><\/p><p id=\"0704\" class=\"pw-post-body-paragraph mi mj fr mk b ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf fk bk\" data-selectable-paragraph=\"\"><strong class=\"mk fs\">We will now create two threads ( processes )<\/strong><\/p><p id=\"d69c\" class=\"pw-post-body-paragraph mi mj fr mk b ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf fk bk\" data-selectable-paragraph=\"\"><strong class=\"mk fs\">The first for the Training samples<\/strong> and the <strong class=\"mk fs\">second<\/strong> for the <strong class=\"mk fs\">Validation Samples<\/strong>. They are completely separated from each other:<\/p><figure class=\"nv nw nx ny nz oa of og paragraph-image\"><\/figure>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4e3cf60 elementor-widget elementor-widget-image\" data-id=\"4e3cf60\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"827\" height=\"580\" data-src=\"https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1ZxsRwTEAMFmt-PUoDSDTIg.webp\" class=\"attachment-large size-large wp-image-871 lazyload\" alt=\"\" data-srcset=\"https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1ZxsRwTEAMFmt-PUoDSDTIg.webp 827w, https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1ZxsRwTEAMFmt-PUoDSDTIg-300x210.webp 300w, https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1ZxsRwTEAMFmt-PUoDSDTIg-768x539.webp 768w, https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1ZxsRwTEAMFmt-PUoDSDTIg-18x12.webp 18w\" data-sizes=\"(max-width: 827px) 100vw, 827px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 827px; --smush-placeholder-aspect-ratio: 827\/580;\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-1dca692 elementor-widget elementor-widget-text-editor\" data-id=\"1dca692\" data-element_type=\"widget\" data-e-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\t\t<p id=\"8054\" class=\"pw-post-body-paragraph mi mj fr mk b ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf fk bk\" data-selectable-paragraph=\"\"><strong class=\"mk fs\">Remember to terminate the producers ( processes ) when you finish to use them , because if you remember the Queue Loader has a infinite loop ( while 1: ).<\/strong><\/p><p id=\"fdb1\" class=\"pw-post-body-paragraph mi mj fr mk b ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf fk bk\" data-selectable-paragraph=\"\">Now we are going to create the generators objects, normally, just using the Queues instead of the Pytables ( or instead of numpy arrays )<\/p><figure class=\"nv nw nx ny nz oa of og paragraph-image\"><\/figure>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-cb8d3ed elementor-widget elementor-widget-image\" data-id=\"cb8d3ed\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"563\" height=\"176\" data-src=\"https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1BTWXL7xp2ullm5kmcROHDg.webp\" class=\"attachment-large size-large wp-image-872 lazyload\" alt=\"\" data-srcset=\"https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1BTWXL7xp2ullm5kmcROHDg.webp 563w, https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1BTWXL7xp2ullm5kmcROHDg-300x94.webp 300w, https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1BTWXL7xp2ullm5kmcROHDg-18x6.webp 18w\" data-sizes=\"(max-width: 563px) 100vw, 563px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 563px; --smush-placeholder-aspect-ratio: 563\/176;\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9ea3f2d elementor-widget elementor-widget-text-editor\" data-id=\"9ea3f2d\" data-element_type=\"widget\" data-e-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\t\t<p id=\"c1d6\" class=\"pw-post-body-paragraph mi mj fr mk b ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf fk bk\" data-selectable-paragraph=\"\"><strong class=\"mk fs\">Last step: Train the Network<\/strong><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-240b883 elementor-widget elementor-widget-image\" data-id=\"240b883\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"845\" height=\"324\" data-src=\"https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1U6X6hCa-4RIMke0hPPKzGw.webp\" class=\"attachment-large size-large wp-image-873 lazyload\" alt=\"\" data-srcset=\"https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1U6X6hCa-4RIMke0hPPKzGw.webp 845w, https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1U6X6hCa-4RIMke0hPPKzGw-300x115.webp 300w, https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1U6X6hCa-4RIMke0hPPKzGw-768x294.webp 768w, https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1U6X6hCa-4RIMke0hPPKzGw-18x7.webp 18w\" data-sizes=\"(max-width: 845px) 100vw, 845px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 845px; --smush-placeholder-aspect-ratio: 845\/324;\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-da153f7 elementor-widget elementor-widget-text-editor\" data-id=\"da153f7\" data-element_type=\"widget\" data-e-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\t\t<p id=\"f00b\" class=\"pw-post-body-paragraph mi mj fr mk b ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf fk bk\" data-selectable-paragraph=\"\">As you can see below we are using here two cores and the GPU is all the time around 70%<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-44e7079 elementor-widget elementor-widget-image\" data-id=\"44e7079\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"993\" height=\"472\" data-src=\"https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1lhmqetG8yQ8mgbmA4cfL3g.webp\" class=\"attachment-large size-large wp-image-874 lazyload\" alt=\"\" data-srcset=\"https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1lhmqetG8yQ8mgbmA4cfL3g.webp 993w, https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1lhmqetG8yQ8mgbmA4cfL3g-300x143.webp 300w, https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1lhmqetG8yQ8mgbmA4cfL3g-768x365.webp 768w, https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1lhmqetG8yQ8mgbmA4cfL3g-18x9.webp 18w\" data-sizes=\"(max-width: 993px) 100vw, 993px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 993px; --smush-placeholder-aspect-ratio: 993\/472;\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f592f14 elementor-widget elementor-widget-text-editor\" data-id=\"f592f14\" data-element_type=\"widget\" data-e-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\t\t<p id=\"8099\" class=\"pw-post-body-paragraph mi mj fr mk b ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf fk bk\" data-selectable-paragraph=\"\">Here the training statistic:<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3922fbf elementor-widget elementor-widget-text-editor\" data-id=\"3922fbf\" data-element_type=\"widget\" data-e-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\t\t<pre class=\"nv nw nx ny nz op oq or os aj ot bk\"><span id=\"da4e\" class=\"ou ld fr oq b ov ow ox m oy oz\" data-selectable-paragraph=\"\">Epoch 1\/1<br \/>2807\/2806 [==============================] - 29s - loss: 0.0368 - val_loss: 0.0271<br \/><br \/>Total number of train samples: 89820 ( shape 128x128)<br \/><br \/>Batch Size                   : 32<br \/><br \/>Duration                     : 0:00:29.998415<br \/>  <br \/> .. model saved to selfdrive_model.h5<\/span><\/pre>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-59fbe05 elementor-widget elementor-widget-text-editor\" data-id=\"59fbe05\" data-element_type=\"widget\" data-e-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\t\t<p id=\"f478\" class=\"pw-post-body-paragraph ym yn uc yo b yp yq yr ys yt yu yv yw yx yy yz za rx zb zc zd ze zf zg zh zi ky bx\" data-selectable-paragraph=\"\">And\u2026 yes because the Intel i3 that I am using is Hyperthreading.. it nicely splits the work between the cores\u2026 But its also thanks all the asynchronous process that we have built that the each core usage is between 40\u201350 % !<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-710b7bb elementor-widget elementor-widget-image\" data-id=\"710b7bb\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"773\" height=\"192\" data-src=\"https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1qw5OdL_VMy4rFO-DQ2CZ9Q.webp\" class=\"attachment-large size-large wp-image-875 lazyload\" alt=\"\" data-srcset=\"https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1qw5OdL_VMy4rFO-DQ2CZ9Q.webp 773w, https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1qw5OdL_VMy4rFO-DQ2CZ9Q-300x75.webp 300w, https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1qw5OdL_VMy4rFO-DQ2CZ9Q-768x191.webp 768w, https:\/\/cristianku.com\/wp-content\/uploads\/2025\/07\/1qw5OdL_VMy4rFO-DQ2CZ9Q-18x4.webp 18w\" data-sizes=\"(max-width: 773px) 100vw, 773px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 773px; --smush-placeholder-aspect-ratio: 773\/192;\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c38dea8 elementor-widget elementor-widget-text-editor\" data-id=\"c38dea8\" data-element_type=\"widget\" data-e-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\t\t<pre class=\"zx zy zz aba abb abp abq abr abs bh abt bx\">ValueError: When creating EArrays, you need to set one of the dimensions of the Atom instance to zero.<\/pre>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2efec9f elementor-widget elementor-widget-text-editor\" data-id=\"2efec9f\" data-element_type=\"widget\" data-e-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\t\t<p id=\"5251\" class=\"pw-post-body-paragraph mi mj fr mk b ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf fk bk\" data-selectable-paragraph=\"\">Remember to terminate the Queue Loaders !:<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6e4a331 elementor-widget elementor-widget-text-editor\" data-id=\"6e4a331\" data-element_type=\"widget\" data-e-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\t\t<pre class=\"zx zy zz aba abb abp abq abr abs bh abt bx\"><strong class=\"mk fs\">training_producer.terminate()<br \/>validation_producer.terminate()<\/strong><\/pre>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>If you read the first part we left at the point that we are goint to build a multi-thread, multiprocesses mechanism. CPU1: reads a big chunk from disk ( 3200 samples ), shuffle it, and insert a memory Buffer ( Queue) CPU2: the second one is the generator that extract a small amount from this&#8230;<\/p>\n<p><a class=\"read-more\" href=\"https:\/\/cristianku.com\/it\/2025\/07\/07\/deep-learning-training-with-huge-amount-of-data-part2\/\">Read More<\/a><\/p>","protected":false},"author":1,"featured_media":640,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[38],"tags":[35,34,36,37],"class_list":["post-860","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-deep-learning","tag-ai","tag-deep-learning","tag-neural-networks","tag-python"],"jetpack_featured_media_url":"https:\/\/cristianku.com\/wp-content\/uploads\/2023\/02\/Screenshot-2025-07-07-at-10.54.15-scaled.jpg","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/cristianku.com\/it\/wp-json\/wp\/v2\/posts\/860","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cristianku.com\/it\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cristianku.com\/it\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cristianku.com\/it\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cristianku.com\/it\/wp-json\/wp\/v2\/comments?post=860"}],"version-history":[{"count":10,"href":"https:\/\/cristianku.com\/it\/wp-json\/wp\/v2\/posts\/860\/revisions"}],"predecessor-version":[{"id":878,"href":"https:\/\/cristianku.com\/it\/wp-json\/wp\/v2\/posts\/860\/revisions\/878"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cristianku.com\/it\/wp-json\/wp\/v2\/media\/640"}],"wp:attachment":[{"href":"https:\/\/cristianku.com\/it\/wp-json\/wp\/v2\/media?parent=860"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cristianku.com\/it\/wp-json\/wp\/v2\/categories?post=860"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cristianku.com\/it\/wp-json\/wp\/v2\/tags?post=860"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}