<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Home</title><link>https://sourceforge.net/p/keras2cpp-multithreading/wiki/Home/</link><description>Recent changes to Home</description><atom:link href="https://sourceforge.net/p/keras2cpp-multithreading/wiki/Home/feed" rel="self"/><language>en</language><lastBuildDate>Mon, 27 Jun 2022 12:41:21 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/keras2cpp-multithreading/wiki/Home/feed" rel="self" type="application/rss+xml"/><item><title>Home modified by ashutosh</title><link>https://sourceforge.net/p/keras2cpp-multithreading/wiki/Home/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v1
+++ v2
@@ -1,8 +1,81 @@
-Welcome to your wiki!
+Welcome to the **keras2cpp multithreading image segmentation** wiki!

-This is the default page, edit it as you see fit. To add a new page simply reference it within brackets, e.g.: [SamplePage].
+Train your image segmentation model in keras and then Convert your keras model into C / C++ /vc++ with multithreading to use directly with your c/c++ program. Very easy to use. Only contains 3 files

-The wiki uses [Markdown](/p/keras2cpp-multithreading/wiki/markdown_syntax/) syntax.
+**1.  keras2cpp.py **- python code to convert your keras model into two text files

-[[members limit=20]]
-[[download_button]]
+**2. keras.cpp and keras.h files** to include it into your c/c++ program and inference your model.
+
+
+**Keras2cpp.py**  - just import or copy and paste the function - save_keras_model_as_text .....
+
+`from keras2cpp import * `
+
+`#load model`
+
+`model=keras.models.load_model('mymodel.h5')`
+
+`#save model into two text files`
+
+`save_keras_model_as_text(model, open('modeltext.txt', 'w') )`
+
+`save_keras_model_as_text(model, open('modellayersonlytext.txt', 'w') , noweight=True)``
+
+
+**Now, Inference model into c/c++**
+
+1. include "Keras.h" file 
+
+2. read an image and convert it into keras format. In example file, we read a ppm image in keras format. If we are using a library like opencv, cximage, cimg etc.. we convert image into our keras format.
+a sample code below - 
+
+
+`unsigned int r,g,b;`
+   
+   `int *img = new int[h*w*3];`
+
+   `int *img_r = img, *img_g =&amp;amp;img[h*w], *img_b=&amp;amp;img[2*h*w];`
+
+      `int k=0;`
+
+      `for (int y = 0; y &amp;lt; h; y++) {`
+
+         `for (int x = 0; x &amp;lt; w;x++) {`
+
+            `read r, g, b`
+
+            `*img_r++ =r; *img_g++ =g; *img_b++ = b;`
+         `}`
+        
+      `}`
+   
+3.  call ExecuteKerasSegmentation(img, h,w, 3, modelfile,weightfile)
+
+`char *modelfile ="C:\\bcrpath\\modellayersonlytext.txt";  `
+
+ `char *weightfile="C:\\bcrpath\\modeltext.txt";`
+
+ `int *result = ExecuteKerasSegmentation(img, h, w, 3, modelfile, weightfile);`
+
+   `delete img;`
+
+   `if(result==NULL)`
+   `{`
+       `AfxMessageBox("Keras error returned null");`
+
+       `return;`
+   `}`
+
+   `save_image_pgm("C:\\bcrpath\\segmentation_map.pgm",result,h,w,127);`
+
+
+the result is a 1d array of 0s and 1s which store segmentation map. The value at 2D point (x,y) can be accessed as result[y*w+x]. In above code, we are saving result in an image file (pgm). For any library, we can use their setpixelcolor/setpixel functions in loop or createfromarray function to convert this array into that library object.
+
+
+
+Note - Irfanview can display ppm /pgm  image files.
+
+
+
+
+
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">ashutosh</dc:creator><pubDate>Mon, 27 Jun 2022 12:41:21 -0000</pubDate><guid>https://sourceforge.net7072f13a3e827c9bec0486236aa2ca19a052c3bd</guid></item><item><title>Home modified by ashutosh</title><link>https://sourceforge.net/p/keras2cpp-multithreading/wiki/Home/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Welcome to your wiki!&lt;/p&gt;
&lt;p&gt;This is the default page, edit it as you see fit. To add a new page simply reference it within brackets, e.g.: &lt;span&gt;[SamplePage]&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;The wiki uses &lt;a class="" href="/p/keras2cpp-multithreading/wiki/markdown_syntax/" rel="nofollow"&gt;Markdown&lt;/a&gt; syntax.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;h6&gt;Project Members:&lt;/h6&gt;
	&lt;ul class="md-users-list"&gt;
		&lt;li&gt;&lt;a href="/u/upashu1/"&gt;ashutosh&lt;/a&gt; (admin)&lt;/li&gt;
		
	&lt;/ul&gt;&lt;br/&gt;
&lt;p&gt;&lt;span class="download-button-62b9a56ebed3c1d77bf8eed3" style="margin-bottom: 1em; display: block;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">ashutosh</dc:creator><pubDate>Mon, 27 Jun 2022 12:41:20 -0000</pubDate><guid>https://sourceforge.netb9df83040c08698f026051b66b61b44c64d03e3d</guid></item></channel></rss>