fxia22/pointnet.pytorch

Error when running show_seg.py

xsf777 opened this issue · 4 comments

OSError: no file with expected extension

File "F:/Users/lenovo/PycharmProjects/pythonProject6/pointnet.pytorch-master/utils/show_seg.py", line 2, in
from show3d_balls import showpoints
File "F:\Users\lenovo\PycharmProjects\pythonProject6\pointnet.pytorch-master\utils\show3d_balls.py", line 22, in
dll = np.ctypeslib.load_library('render_balls_so', '.')
File "F:\anaconda\envs\pytorch3\lib\site-packages\numpy\ctypeslib.py", line 155, in load_library
raise OSError("no file with expected extension")

I refer to this link and put the following code:

import numpy as np
import ctypes as ct
import cv2
import sys
showsz = 800
mousex, mousey = 0.5, 0.5
zoom = 1.0
changed = True
def onmouse(*args):
global mousex, mousey, changed
y = args[1]
x = args[2]
mousex = x / float(showsz)
mousey = y / float(showsz)
changed = True
cv2.namedWindow('show3d')
cv2.moveWindow('show3d', 0, 0)
cv2.setMouseCallback('show3d', onmouse)
dll = np.ctypeslib.load_library('render_balls_so', '.')

change it to this:

import numpy as np
import ctypes as ct
import cv2
import sys
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
showsz=800
mousex,mousey=0.5,0.5
zoom=1.0
changed=True
def onmouse(*args):
    global mousex,mousey,changed
    y=args[1]
    x=args[2]
    mousex=x/float(showsz)
    mousey=y/float(showsz)
    changed=True
cv2.namedWindow('show3d')
cv2.moveWindow('show3d',0,0)
cv2.setMouseCallback('show3d',onmouse)


dll=np.ctypeslib.load_library(os.path.join(BASE_DIR, 'render_balls_so'),'.')

It's ready to go.

I hope that will help you. :)

Thanks,this help me a lot

@HeBangYan
Hello I tried your solution but nothing changed in my case. Do you have any suggestions? I am still receiving the same error.

Actually there is the file 'render_balls_so.so' in the foloder of pointnet.pytorch/utils, So just modified as below:
dll = np.ctypeslib.load_library('render_balls_so.so', '.')

It worked for me, The error 'OSError: no file with expected extension' disappeared and the chair display in my macbook M1
Screenshot 2023-02-03 at 05 37 28