Skip to content

Commit

Permalink
Deploying to gh-pages from main @ fc41eb4 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
benjijamorris committed Mar 9, 2024
1 parent 28aa079 commit 21ff2b7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions _modules/cyto_dl/models/im2im/utils/instance_seg.html
Original file line number Diff line number Diff line change
Expand Up @@ -910,12 +910,11 @@ <h1>Source code for cyto_dl.models.im2im.utils.instance_seg</h1><div class="high
<span class="k">return</span> <span class="n">out</span></div>

<span class="k">def</span> <span class="fm">__call__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">image</span><span class="p">):</span>
<span class="n">image</span> <span class="o">=</span> <span class="n">image</span><span class="o">.</span><span class="n">detach</span><span class="p">()</span><span class="o">.</span><span class="n">cpu</span><span class="p">()</span><span class="o">.</span><span class="n">half</span><span class="p">()</span><span class="o">.</span><span class="n">numpy</span><span class="p">()</span>
<span class="n">image</span> <span class="o">=</span> <span class="n">image</span><span class="o">.</span><span class="n">detach</span><span class="p">()</span><span class="o">.</span><span class="n">half</span><span class="p">()</span>
<span class="n">naive_labeling</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">label</span><span class="p">((</span><span class="n">image</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">semantic_threshold</span><span class="p">)</span><span class="o">.</span><span class="n">cpu</span><span class="p">())</span>
<span class="n">skel</span> <span class="o">=</span> <span class="n">image</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">cpu</span><span class="p">()</span><span class="o">.</span><span class="n">numpy</span><span class="p">()</span>
<span class="n">embedding</span> <span class="o">=</span> <span class="n">image</span><span class="p">[</span><span class="mi">2</span> <span class="p">:</span> <span class="mi">2</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">dim</span><span class="p">]</span><span class="o">.</span><span class="n">cpu</span><span class="p">()</span><span class="o">.</span><span class="n">numpy</span><span class="p">()</span>

<span class="n">skel</span> <span class="o">=</span> <span class="n">image</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="n">naive_labeling</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">label</span><span class="p">(</span><span class="n">image</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">semantic_threshold</span><span class="p">)</span>

<span class="n">embedding</span> <span class="o">=</span> <span class="n">image</span><span class="p">[</span><span class="mi">2</span> <span class="p">:</span> <span class="mi">2</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">dim</span><span class="p">]</span>
<span class="n">regions</span> <span class="o">=</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">find_objects</span><span class="p">(</span><span class="n">naive_labeling</span><span class="p">),</span> <span class="n">start</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>

<span class="n">highest_cell_idx</span> <span class="o">=</span> <span class="mi">0</span>
Expand Down

0 comments on commit 21ff2b7

Please sign in to comment.