You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While All major browsers now support OffscreenCanvas, tfjs fails to create a WebGL backend on a MacOS computer running a webworker with Safari, even though the WebGL backend works on the main thread. On the same machine, Chrome and Firefox work correctly both on the main thread and on a web worker.
git clone https://github.com/neurolabusc/niivue-brainchop.git
cd niivue-brainchop
npm install
npm run dev
In both cases, a model is run when you select a Segmentation model from the drop down menu (hint: choose the Fast ones to get a rapid solution).
System information
Have I written custom code (as opposed to using a stock example script provided in TensorFlow.js): yes, example provided
OS Platform and Distribution (e.g., Linux Ubuntu 16.04): MacOS 13.6.6
Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: no
TensorFlow.js installed from: npm
TensorFlow.js version: 4.18.0
Browser version: Safari Version 17.4.1 (18618.1.15.111.8, 18618)
Tensorflow.js Converter Version:
Describe the current behavior
Models work in main thread for Chrome, Firefox and Safari. Webworker only works for Chrome and Firefox. Safari webworker reports Initialization of backend webgl failed
Describe the expected behavior
Since all browsers now support OffscreenCanvas, webworkers should work on all devices. Safari explicitly reports supporting offscreen canvases when running this code snippet:
if (typeof OffscreenCanvas !== 'undefined') {
console.log('OffscreenCanvas is supported');
} else {
console.log('OffscreenCanvas is NOT supported');
}
git clone https://github.com/neurolabusc/niivue-brainchop.git
cd niivue-brainchop
npm install
npm run dev
Other info / logs
$ system_profiler SPSoftwareDataType SPHardwareDataType
$ system_profiler SPSoftwareDataType
Software:
System Software Overview:
System Version: macOS 13.6.6 (22G630)
Kernel Version: Darwin 22.6.0
Boot Volume: Macintosh HD
Boot Mode: Normal
System Integrity Protection: Enabled
Time since boot: 3 days, 22 hours, 28 minutes
Hardware:
Hardware Overview:
Model Name: MacBook Pro
Model Identifier: Mac14,10
Model Number: MNWD3LL/A
Chip: Apple M2 Pro
Total Number of Cores: 12 (8 performance and 4 efficiency)
Memory: 16 GB
System Firmware Version: 10151.101.3
OS Loader Version: 8422.141.2.700.1
Activation Lock Status: Enabled
Software:
System Software Overview:
System Version: macOS 13.6.6 (22G630)
Kernel Version: Darwin 22.6.0
Boot Volume: Macintosh HD
Boot Mode: Normal
Secure Virtual Memory: Enabled
System Integrity Protection: Enabled
The text was updated successfully, but these errors were encountered:
I apologize for the delay in my response. I tested the live demo using Safari browser version 17.4.1 (19618.1.15.11.14) and did not encounter the reported error Error when getting WebGL Context. For your reference, I have attached a screenshot (if applicable). Please let me know if I have missed something here.
@gaikwadrahul8 thanks for checking. I still observe the error with Safari 17.5 when I choose the webworker. I am using a Apple M2 GPU - is it possible you are using a different GPU (e.g. Intel, AMD, etc)?
You can run the sysctl hw.model command from the terminal to provide details regarding your hardware:
$ sysctl hw.model
hw.model: Mac14,10
Also, after the brainchop model finishes, you can press Show Diagnostics to reveal details about your setup. For me, I get:
:: Diagnostics can help resolve issues https://github.com/neuroneural/brainchop/issues ::
TF_Backend: webgl
isModelFullVol: true
No_SubVolumes: 1
Brainchop_Ver: FullVolume
Input_Shape: [null,198,198,258,1]
Output_Shape: [null,256,256,256,3]
Channel_Last: true
Model_Param: 5598
Model_Layers: 20
Model: ⚡ Brain Mask (FAST)
Extra_Info: null
Actual_Labels: 3
Expect_Labels: 3
NumLabels_Match: true
Inference_t: 3.0440
Postprocess_t: 1.6050
Status: OK
Total_t: 6.5
Date: 5/27/2024
Browser: Safari
Browser_Ver: 605
OS: MacOS
WebGL2: true
GPU_Vendor: Apple Inc.
GPU_Card: Apple GPU
GPU_Vendor_Full: Apple Inc.
GPU_Card_Full: Apple GPU
CPU_Cores: 8
Which_Brainchop: latest
Texture_Size: 16384
While All major browsers now support OffscreenCanvas, tfjs fails to create a WebGL backend on a MacOS computer running a webworker with Safari, even though the WebGL backend works on the main thread. On the same machine, Chrome and Firefox work correctly both on the main thread and on a web worker.
You can try this out in this live demo
Alternatively, you build a hot-loading example
In both cases, a model is run when you select a
Segmentation model
from the drop down menu (hint: choose theFast
ones to get a rapid solution).System information
Describe the current behavior
Models work in main thread for Chrome, Firefox and Safari. Webworker only works for Chrome and Firefox. Safari webworker reports
Initialization of backend webgl failed
Describe the expected behavior
Since all browsers now support OffscreenCanvas, webworkers should work on all devices. Safari explicitly reports supporting offscreen canvases when running this code snippet:
Standalone code to reproduce the issue
You can try this out in this live demo
Alternatively, you build a hot-loading example
Other info / logs
The text was updated successfully, but these errors were encountered: