René's URL Explorer Experiment


Title: Example code only works for square image [bug] · Issue #34 · transformify-plugins/segmentify · GitHub

Open Graph Title: Example code only works for square image [bug] · Issue #34 · transformify-plugins/segmentify

X Title: Example code only works for square image [bug] · Issue #34 · transformify-plugins/segmentify

Description: Expected behavior segmentify should work for non-square images (width != length, ex. 512x512 is square, 511x512 is not square) Potentially relevant issues/PR #11 #13 How to reproduce the bug Below is a slightly modified version of https:...

Open Graph Description: Expected behavior segmentify should work for non-square images (width != length, ex. 512x512 is square, 511x512 is not square) Potentially relevant issues/PR #11 #13 How to reproduce the bug Below ...

X Description: Expected behavior segmentify should work for non-square images (width != length, ex. 512x512 is square, 511x512 is not square) Potentially relevant issues/PR #11 #13 How to reproduce the bug Below ...

Opengraph URL: https://github.com/transformify-plugins/segmentify/issues/34

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Example code only works for square image [bug]","articleBody":"## Expected behavior\r\n`segmentify` should work for non-square images (width != length, ex. 512x512 is square, 511x512 is not square)\r\n\r\n## Potentially relevant issues/PR\r\n#11 #13 \r\n\r\n## How to reproduce the bug\r\nBelow is a slightly modified version of https://github.com/transformify-plugins/segmentify/blob/master/examples/launch.py  \r\n1. Run the code as is, popping the napari window; click `execute` button, confirm working\r\n2. Un-comment the two lines right before `napari.gui_qt`; run the code, popping the napari window, click `execute` button, and confirm it crashes\r\n```\r\nimport os\r\nimport napari\r\nfrom segmentify import segmentation\r\nimport numpy as np\r\nfrom skimage import io\r\n\r\n\r\n# parse input file\r\nexample_image = os.path.join(os.path.abspath(os.path.dirname(__file__)), \"hpa.png\")\r\nexample_labels = os.path.join(os.path.abspath(os.path.dirname(__file__)), \"hpa_labels.tif\")\r\n\r\nexample_image = io.imread(example_image)\r\nexample_labels = io.imread(example_labels)\r\n\r\n### WARNING: uncomment these two lines below to reproduce bug ###\r\n#example_image = example_image[:, 1:]\r\n#example_labels = example_labels[:, 1:]\r\n##########################################################\r\n\r\nwith napari.gui_qt():\r\n    viewer = napari.Viewer()\r\n\r\n    # instantiate the widget\r\n    gui = segmentation.Gui()\r\n\r\n    # add our new widget to the napari viewer\r\n    viewer.window.add_dock_widget(gui)\r\n\r\n    # keep the dropdown menus in the gui in sync with the layer model\r\n    viewer.layers.events.changed.connect(lambda x: gui.refresh_choices())\r\n\r\n    gui.refresh_choices()\r\n\r\n    # load data\r\n    viewer.add_image(example_image)\r\n    viewer.add_labels(example_labels)\r\n```\r\n\r\n## Full error message\r\n```\r\nSegmenting...\r\nWARNING: Traceback (most recent call last):\r\n  File \"/home/hungyiwu/.venv/segmentify/lib/python3.8/site-packages/magicgui-0.1.5-py3.8.egg/magicgui/core.py\", line 199, in \u003clambda\u003e\r\n    self.call_button.clicked.connect(lambda checked: self.__call__())\r\n  File \"/home/hungyiwu/.venv/segmentify/lib/python3.8/site-packages/magicgui-0.1.5-py3.8.egg/magicgui/core.py\", line 526, in __call__\r\n    value = self.func(**_kwargs)\r\n  File \"/home/hungyiwu/.venv/segmentify/lib/python3.8/site-packages/segmentify-0.1.1-py3.8.egg/segmentify/gui.py\", line 29, in segmentation\r\n    clf, features = fit(data, initial_labels.data, featurizer=featurizer.value)\r\n  File \"/home/hungyiwu/.venv/segmentify/lib/python3.8/site-packages/segmentify-0.1.1-py3.8.egg/segmentify/semantic/main.py\", line 129, in fit\r\n    padded_features = unet_featurize(padded_image, featurizer)\r\n  File \"/home/hungyiwu/.venv/segmentify/lib/python3.8/site-packages/segmentify-0.1.1-py3.8.egg/segmentify/semantic/main.py\", line 59, in unet_featurize\r\n    features = model(image)\r\n  File \"/home/hungyiwu/.venv/segmentify/lib/python3.8/site-packages/torch-1.5.1-py3.8-linux-x86_64.egg/torch/nn/modules/module.py\", line 550, in __call__\r\n    result = self.forward(*input, **kwargs)\r\n  File \"/home/hungyiwu/.venv/segmentify/lib/python3.8/site-packages/segmentify-0.1.1-py3.8.egg/segmentify/model/unet.py\", line 57, in forward\r\n    x = self.decode_4(x, skip_4)\r\n  File \"/home/hungyiwu/.venv/segmentify/lib/python3.8/site-packages/torch-1.5.1-py3.8-linux-x86_64.egg/torch/nn/modules/module.py\", line 550, in __call__\r\n    result = self.forward(*input, **kwargs)\r\n  File \"/home/hungyiwu/.venv/segmentify/lib/python3.8/site-packages/segmentify-0.1.1-py3.8.egg/segmentify/model/layers/unet_layers.py\", line 63, in forward\r\n    output += skip\r\nRuntimeError: The size of tensor a (62) must match the size of tensor b (63) at non-singleton dimension 3\r\nAborted (core dumped)\r\n```\r\n\r\n## Environment, version, and other information\r\npython 3.8.2\r\nnapari 0.3.5\r\nnapari-plugin-engine 0.1.6\r\nnapari-svg 0.1.3\r\nsegmentify 0.1.1 (installed by cloning this repo and `python setup.py install` the `master` branch)\r\nUbuntu 20.04\r\npython venv\r\n`pip freeze \u003e `[requirements.txt](https://github.com/transformify-plugins/segmentify/files/4837652/requirements.txt)\r\n","author":{"url":"https://github.com/hungyiwu","@type":"Person","name":"hungyiwu"},"datePublished":"2020-06-26T15:07:55.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/34/segmentify/issues/34"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:4180561f-42c0-a0d7-6ad3-01226fa9213b
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC77C:F07F1:AD5FBC:EEA571:698E12B7
html-safe-noncebd3d135cf0bf7cff12e6c43a1895fce2e402e040cc258ad7722ba7936036467e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNzdDOkYwN0YxOkFENUZCQzpFRUE1NzE6Njk4RTEyQjciLCJ2aXNpdG9yX2lkIjoiMjg1MDEwMjEyNTcyNzE5MTczNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacb03b365315ec3554ee3d554cbbd4dc7c841a92e098056b0c5af438f5e2029244
hovercard-subject-tagissue:646327777
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/transformify-plugins/segmentify/34/issue_layout
twitter:imagehttps://opengraph.githubassets.com/ce26afd1a8ee2c5ed6e51253b8d6961057d427b6fa884533031cd35cb04d467d/transformify-plugins/segmentify/issues/34
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/ce26afd1a8ee2c5ed6e51253b8d6961057d427b6fa884533031cd35cb04d467d/transformify-plugins/segmentify/issues/34
og:image:altExpected behavior segmentify should work for non-square images (width != length, ex. 512x512 is square, 511x512 is not square) Potentially relevant issues/PR #11 #13 How to reproduce the bug Below ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamehungyiwu
hostnamegithub.com
expected-hostnamegithub.com
Nonefdf74c91c9ac187cc5cd7b14d4af2d6ef3e18136d002f5d36253f8538e97ee4c
turbo-cache-controlno-preview
go-importgithub.com/transformify-plugins/segmentify git https://github.com/transformify-plugins/segmentify.git
octolytics-dimension-user_id51755733
octolytics-dimension-user_logintransformify-plugins
octolytics-dimension-repository_id189932552
octolytics-dimension-repository_nwotransformify-plugins/segmentify
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id189932552
octolytics-dimension-repository_network_root_nwotransformify-plugins/segmentify
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release1a5a3e7bbfb3486980e340c242368684156fba87
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/transformify-plugins/segmentify/issues/34#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Ftransformify-plugins%2Fsegmentify%2Fissues%2F34
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Ftransformify-plugins%2Fsegmentify%2Fissues%2F34
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=transformify-plugins%2Fsegmentify
Reloadhttps://patch-diff.githubusercontent.com/transformify-plugins/segmentify/issues/34
Reloadhttps://patch-diff.githubusercontent.com/transformify-plugins/segmentify/issues/34
Reloadhttps://patch-diff.githubusercontent.com/transformify-plugins/segmentify/issues/34
transformify-plugins https://patch-diff.githubusercontent.com/transformify-plugins
segmentifyhttps://patch-diff.githubusercontent.com/transformify-plugins/segmentify
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Ftransformify-plugins%2Fsegmentify
Fork 8 https://patch-diff.githubusercontent.com/login?return_to=%2Ftransformify-plugins%2Fsegmentify
Star 31 https://patch-diff.githubusercontent.com/login?return_to=%2Ftransformify-plugins%2Fsegmentify
Code https://patch-diff.githubusercontent.com/transformify-plugins/segmentify
Issues 10 https://patch-diff.githubusercontent.com/transformify-plugins/segmentify/issues
Pull requests 2 https://patch-diff.githubusercontent.com/transformify-plugins/segmentify/pulls
Actions https://patch-diff.githubusercontent.com/transformify-plugins/segmentify/actions
Projects 0 https://patch-diff.githubusercontent.com/transformify-plugins/segmentify/projects
Security 0 https://patch-diff.githubusercontent.com/transformify-plugins/segmentify/security
Insights https://patch-diff.githubusercontent.com/transformify-plugins/segmentify/pulse
Code https://patch-diff.githubusercontent.com/transformify-plugins/segmentify
Issues https://patch-diff.githubusercontent.com/transformify-plugins/segmentify/issues
Pull requests https://patch-diff.githubusercontent.com/transformify-plugins/segmentify/pulls
Actions https://patch-diff.githubusercontent.com/transformify-plugins/segmentify/actions
Projects https://patch-diff.githubusercontent.com/transformify-plugins/segmentify/projects
Security https://patch-diff.githubusercontent.com/transformify-plugins/segmentify/security
Insights https://patch-diff.githubusercontent.com/transformify-plugins/segmentify/pulse
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/transformify-plugins/segmentify/issues/34
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/transformify-plugins/segmentify/issues/34
Example code only works for square image [bug]https://patch-diff.githubusercontent.com/transformify-plugins/segmentify/issues/34#top
https://github.com/hungyiwu
https://github.com/hungyiwu
hungyiwuhttps://github.com/hungyiwu
on Jun 26, 2020https://github.com/transformify-plugins/segmentify/issues/34#issue-646327777
#11https://github.com/transformify-plugins/segmentify/issues/11
#13https://github.com/transformify-plugins/segmentify/pull/13
https://github.com/transformify-plugins/segmentify/blob/master/examples/launch.pyhttps://github.com/transformify-plugins/segmentify/blob/master/examples/launch.py
requirements.txthttps://github.com/transformify-plugins/segmentify/files/4837652/requirements.txt
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.