Closed myuser-git closed 10 months ago
Hello, would you please share the version of your DLPy and cas?
Viya version is 2023.08 Dlpy version is 1.2.1-dev
Can you try ImgTbl = ImageTable.load_files(s, path='path_to_your_images', casout=dict(name='vt_data')) ImgTbl.show()
This was resolved by changing the way of connecting to Viya. The user ended up using binary connectivity instead of REST.
The following code runs on an instance of JupyterHub with Python 3.10 and dlpy-dev (1.2.1-dev):
Do not modify this file!
import swat conn = swat.CAS('https://iot.viya-azure-3.unx.sas.com:443/cas-shared-default-http', username='macazz',password='xxxxxx') out = conn.serverstatus() out import dlpy from dlpy.utils import from dlpy.images import ImageTable from dlpy.model import from dlpy import Model, Sequential from dlpy.layers import from dlpy.applications import from dlpy.splitting import two_way_split from dlpy.blocks import * import PIL.Image print(dlpy.version)
s.tableinfo() s.loadactionset('image') s.loadactionset('deepLearn') s.loadactionset('astore') modelPath='/home/jukhar/Common_Data/Juthika/Giraffe_Dolphin/' s.table.addcaslib(activeonadd=False,datasource={'srctype':'path'},name='dnfs',path=modelPath,subdirectories=True) s.setsessopt(caslib='dnfs') my_images = s.image.loadimages(casout=dict(name='vt_data', replace=True), caslib='dnfs', recurse=True, labellevels=2) trainImgTbl = s.CASTable('vt_data') Img = ImageTable.from_table(trainImgTbl) Img.show()
Output:
NOTE: Grid node action status report: 1 nodes, 9 total actions executed. 1.2.1-dev NOTE: No tables are available in caslib CASUSER(macazz) of Cloud Analytic Services. NOTE: Added action set 'image'. NOTE: Added action set 'deepLearn'. NOTE: Added action set 'astore'. NOTE: Cloud Analytic Services added the caslib 'dnfs'. NOTE: 'dnfs' is now the active caslib. NOTE: Loaded 257 images from /home/jukhar/Common_Data/Juthika/Giraffe_Dolphin/ into Cloud Analytic Services table vt_data. **--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In[6], line 11 9 trainImgTbl = s.CASTable('vt_data') 10 Img = ImageTable.from_table(trainImgTbl) ---> 11 Img.show()
File /opt/conda/lib/python3.10/site-packages/dlpy/images.py:514, in ImageTable.show(self, nimages, ncol, randomize, figsize, where, id) 512 else: 513 ax.set_title('{}'.format(label)) --> 514 if len(image.size) == 2: 515 plt.imshow(np.array(image), cmap='Greys_r') 516 else:
AttributeError: 'bytes' object has no attribute 'size'**
Any insight would be greatly appreciated.