最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - UnboundLocalError in SegmentEveryGrain - Stack Overflow

programmeradmin0浏览0评论

I am using a tool called SegmentEveryGrain (). I am a beginner to coding and python and receiving the error "UnboundLocalError: local variable 'all_coords' referenced before assignment when I run the block "Run segmentation on large image (new!)".

I understand that this is telling me that 'all_coords' is being called before it has been defined (I believe?), however I am unsure exactly how to fix this. It seems unlikely to me that this is a problem with the code, and more likely that I have set something up incorrectly.

I am working in a python environment that I set up in the directory that I saved the repo to locally. I have also tried switching interpreters with no luck.

Does anyone have experience with SegmentEveryGrain or a similar situation?

Thanks!

![error image]

Traceback message:

UnboundLocalError                         Traceback (most recent call last)
Cell In[8], line 4
      2 Image.MAX_IMAGE_PIXELS = None # needed if working with very large images
      3 fname = "W:\\_Working\\HI_Data_2024\\_Segmentation\\images\\20240722_Waimea_patch2.tif"
----> 4 all_grains, image_pred, all_coords = seg.predict_large_image(fname, model, sam, min_area=400.0, patch_size=2000, overlap=200)

The full code is too long to include here but I have included a link to the github above.

发布评论

评论列表(0)

  1. 暂无评论