<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Getting error when training MMSegmentation by notebook in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/getting-error-when-training-mmsegmentation-by/m-p/1609605#M95339</link>
    <description>&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;I encounter this error when I tried MMSegmentation from API for Python using Jupyter Notebook.&lt;/P&gt;&lt;P&gt;I imported necessary libraries, define data normally&lt;/P&gt;&lt;P&gt;import os&lt;BR /&gt;from pathlib import Path&lt;BR /&gt;import arcgis&lt;BR /&gt;from arcgis.gis import GIS&lt;BR /&gt;from arcgis.learn import MMSegmentation, prepare_data&lt;/P&gt;&lt;P&gt;import torch&lt;BR /&gt;torch.cuda.set_device(0)&lt;/P&gt;&lt;P&gt;data_path = r'mypath\\TD_384x384' (omit here)&lt;/P&gt;&lt;P&gt;data = prepare_data(path=data_path,&lt;BR /&gt;chip_size=384,&lt;BR /&gt;val_split_pct=0.2,&lt;BR /&gt;batch_size=8,&lt;BR /&gt;transform=None,&lt;BR /&gt;seed=42,&lt;BR /&gt;working_dir=r'mypath\\temp' (omit here)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;And then define model&lt;/P&gt;&lt;P&gt;# Define model&lt;BR /&gt;#cfg = r'D:\mmsegmentation\configs\mask2former\mask2former_swin-l-in22k-384x384-pre_8xb2-90k_cityscapes-512x1024.py'&lt;BR /&gt;#wts = r'D:\mmsegmentation\mask2former\mask2former_swin-l-in22k-384x384-pre_8xb2-90k_cityscapes-512x1024_20221202_141901-28ad20f1.pth'&lt;BR /&gt;model = MMSegmentation.model(data=data,&lt;BR /&gt;model='mask2former',&lt;BR /&gt;#weights=wts&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;it showed error&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;AttributeError&lt;/SPAN&gt;                            Traceback (most recent call last)
Cell &lt;SPAN class=""&gt;In[12], line 4&lt;/SPAN&gt;
&lt;SPAN class=""&gt;      1&lt;/SPAN&gt; &lt;SPAN&gt;# Define model&lt;/SPAN&gt;
&lt;SPAN class=""&gt;      2&lt;/SPAN&gt; &lt;SPAN&gt;#cfg = r'&lt;/SPAN&gt;&lt;SPAN&gt;D:\mmsegmentation\configs\mask2former\mask2former_swin-l-in22k-384x384-pre_8xb2-90k_cityscapes-512x1024.py&lt;/SPAN&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;
&lt;SPAN class=""&gt;      3&lt;/SPAN&gt; &lt;SPAN&gt;#wts = r'&lt;/SPAN&gt;&lt;A target="_blank"&gt;&lt;SPAN&gt;D:\mmsegmentation\mask2former\mask2former_swin-l-in22k-384x384-pre_8xb2-90k_cityscapes-512x1024_20221202_141901-28ad20f1.pth&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;
&lt;SPAN class=""&gt;----&amp;gt; 4&lt;/SPAN&gt; model &lt;SPAN&gt;=&lt;/SPAN&gt; MMSegmentation&lt;SPAN&gt;.&lt;/SPAN&gt;model(data&lt;SPAN&gt;=&lt;/SPAN&gt;data,
&lt;SPAN class=""&gt;      5&lt;/SPAN&gt;                              model&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;mask2former&lt;/SPAN&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;,
&lt;SPAN class=""&gt;      6&lt;/SPAN&gt;                              &lt;SPAN&gt;#weights=wts&lt;/SPAN&gt;
&lt;SPAN class=""&gt;      7&lt;/SPAN&gt;                             )

&lt;SPAN class=""&gt;AttributeError&lt;/SPAN&gt;: type object 'MMSegmentation' has no attribute 'model'&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;I found it is really strange, why there is no attribute 'model' for object 'MMSegmentation'?&lt;/P&gt;&lt;P&gt;Event I tried to define the model manually, the same error occured.&lt;/P&gt;&lt;P&gt;I ran ArcGIS Pro 3.4 on Windows 11; I have trained many model with Notebook before, so I don't think I have any problems with the Deep Learning Library of ArcGIS Pro.&lt;/P&gt;</description>
    <pubDate>Mon, 28 Apr 2025 09:58:22 GMT</pubDate>
    <dc:creator>ThangPham</dc:creator>
    <dc:date>2025-04-28T09:58:22Z</dc:date>
    <item>
      <title>Getting error when training MMSegmentation by notebook</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/getting-error-when-training-mmsegmentation-by/m-p/1609605#M95339</link>
      <description>&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;I encounter this error when I tried MMSegmentation from API for Python using Jupyter Notebook.&lt;/P&gt;&lt;P&gt;I imported necessary libraries, define data normally&lt;/P&gt;&lt;P&gt;import os&lt;BR /&gt;from pathlib import Path&lt;BR /&gt;import arcgis&lt;BR /&gt;from arcgis.gis import GIS&lt;BR /&gt;from arcgis.learn import MMSegmentation, prepare_data&lt;/P&gt;&lt;P&gt;import torch&lt;BR /&gt;torch.cuda.set_device(0)&lt;/P&gt;&lt;P&gt;data_path = r'mypath\\TD_384x384' (omit here)&lt;/P&gt;&lt;P&gt;data = prepare_data(path=data_path,&lt;BR /&gt;chip_size=384,&lt;BR /&gt;val_split_pct=0.2,&lt;BR /&gt;batch_size=8,&lt;BR /&gt;transform=None,&lt;BR /&gt;seed=42,&lt;BR /&gt;working_dir=r'mypath\\temp' (omit here)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;And then define model&lt;/P&gt;&lt;P&gt;# Define model&lt;BR /&gt;#cfg = r'D:\mmsegmentation\configs\mask2former\mask2former_swin-l-in22k-384x384-pre_8xb2-90k_cityscapes-512x1024.py'&lt;BR /&gt;#wts = r'D:\mmsegmentation\mask2former\mask2former_swin-l-in22k-384x384-pre_8xb2-90k_cityscapes-512x1024_20221202_141901-28ad20f1.pth'&lt;BR /&gt;model = MMSegmentation.model(data=data,&lt;BR /&gt;model='mask2former',&lt;BR /&gt;#weights=wts&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;it showed error&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;AttributeError&lt;/SPAN&gt;                            Traceback (most recent call last)
Cell &lt;SPAN class=""&gt;In[12], line 4&lt;/SPAN&gt;
&lt;SPAN class=""&gt;      1&lt;/SPAN&gt; &lt;SPAN&gt;# Define model&lt;/SPAN&gt;
&lt;SPAN class=""&gt;      2&lt;/SPAN&gt; &lt;SPAN&gt;#cfg = r'&lt;/SPAN&gt;&lt;SPAN&gt;D:\mmsegmentation\configs\mask2former\mask2former_swin-l-in22k-384x384-pre_8xb2-90k_cityscapes-512x1024.py&lt;/SPAN&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;
&lt;SPAN class=""&gt;      3&lt;/SPAN&gt; &lt;SPAN&gt;#wts = r'&lt;/SPAN&gt;&lt;A target="_blank"&gt;&lt;SPAN&gt;D:\mmsegmentation\mask2former\mask2former_swin-l-in22k-384x384-pre_8xb2-90k_cityscapes-512x1024_20221202_141901-28ad20f1.pth&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;
&lt;SPAN class=""&gt;----&amp;gt; 4&lt;/SPAN&gt; model &lt;SPAN&gt;=&lt;/SPAN&gt; MMSegmentation&lt;SPAN&gt;.&lt;/SPAN&gt;model(data&lt;SPAN&gt;=&lt;/SPAN&gt;data,
&lt;SPAN class=""&gt;      5&lt;/SPAN&gt;                              model&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;mask2former&lt;/SPAN&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;,
&lt;SPAN class=""&gt;      6&lt;/SPAN&gt;                              &lt;SPAN&gt;#weights=wts&lt;/SPAN&gt;
&lt;SPAN class=""&gt;      7&lt;/SPAN&gt;                             )

&lt;SPAN class=""&gt;AttributeError&lt;/SPAN&gt;: type object 'MMSegmentation' has no attribute 'model'&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;I found it is really strange, why there is no attribute 'model' for object 'MMSegmentation'?&lt;/P&gt;&lt;P&gt;Event I tried to define the model manually, the same error occured.&lt;/P&gt;&lt;P&gt;I ran ArcGIS Pro 3.4 on Windows 11; I have trained many model with Notebook before, so I don't think I have any problems with the Deep Learning Library of ArcGIS Pro.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Apr 2025 09:58:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/getting-error-when-training-mmsegmentation-by/m-p/1609605#M95339</guid>
      <dc:creator>ThangPham</dc:creator>
      <dc:date>2025-04-28T09:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: Getting error when training MMSegmentation by notebook</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/getting-error-when-training-mmsegmentation-by/m-p/1611507#M95511</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/746117"&gt;@ThangPham&lt;/a&gt;,&lt;/P&gt;&lt;P class=""&gt;The code you shared includes an extra reference to the model during initialization. Could you please try again after replacing "MMSegmentation.model" with "MMSegmentation"?&lt;/P&gt;&lt;P class=""&gt;Use the code below instead:&lt;/P&gt;&lt;P&gt;"&lt;SPAN&gt;model = MMSegmentation(data=data,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; model='mask2former',&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #weights=wts&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;"&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jun 2025 09:17:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/getting-error-when-training-mmsegmentation-by/m-p/1611507#M95511</guid>
      <dc:creator>ShivaniPathak</dc:creator>
      <dc:date>2025-06-16T09:17:29Z</dc:date>
    </item>
    <item>
      <title>Re: Getting error when training MMSegmentation by notebook</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/getting-error-when-training-mmsegmentation-by/m-p/1622182#M96480</link>
      <description>&lt;P&gt;Hello, thank you for your reply. After checking the code, I also realized my mistake.&lt;/P&gt;&lt;P&gt;It should be model =&amp;nbsp;MMSegmentation(); not model =&amp;nbsp;MMSegmentation.model().&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jun 2025 06:58:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/getting-error-when-training-mmsegmentation-by/m-p/1622182#M96480</guid>
      <dc:creator>ThangPham</dc:creator>
      <dc:date>2025-06-10T06:58:30Z</dc:date>
    </item>
  </channel>
</rss>

