Tag Archives: 3d

[Solved] headless pyrender offscreen render Error: OpenGL.error.GLError: GLError(err = 12296,

Error description

When running vibe, the CentOS server without display is used. When using pyrender for off screen rendering, errors are reported OpenGL.error.GLError: GLError(err = 12296), as follows:

Traceback (most recent call last):
  File "demo.py", line 416, in <module>
    main(args)
  File "demo.py", line 278, in main
    renderer = Renderer(resolution=(orig_width, orig_height), orig_img=True, wireframe=args.wireframe)
  File "***/VIBE/lib/utils/renderer.py", line 60, in __init__
    point_size=1.0
  File "***/anaconda3/envs/vibe-env/lib/python3.7/site-packages/pyrender/offscreen.py", line 31, in __init__
    self._create()
  File "***/anaconda3/envs/vibe-env/lib/python3.7/site-packages/pyrender/offscreen.py", line 134, in _create
    self._platform.init_context()
  File "***/anaconda3/envs/vibe-env/lib/python3.7/site-packages/pyrender/platforms/egl.py", line 177, in init_context
    assert eglInitialize(self._egl_display, major, minor)
  File "***/anaconda3/envs/vibe-env/lib/python3.7/site-packages/OpenGL/platform/baseplatform.py", line 409, in __call__
    return self( *args, **named )
  File "***/anaconda3/envs/vibe-env/lib/python3.7/site-packages/OpenGL/error.py", line 232, in glCheckError
    baseOperation = baseOperation,
OpenGL.error.GLError: GLError(
        err = 12296,
        baseOperation = eglInitialize,
        cArguments = (
                <OpenGL._opaque.EGLDisplay_pointer object at 0x7f883a03a170>,
                c_long(0),
                c_long(0),
        ),
        result = 0
)

Solution

Ubuntu: https://pyrender.readthedocs.io/en/latest/install/index.html#installmesa Use OSMesa to offscreen render.

It is more convenient to use · CONDA · to install osmesa as follows:

conda install osmesa

Note: after installing osmesa, reinstall pyopengl, otherwise an error will still be reported, as follows:

pip uninstall pyopengl
git clone https://github.com/mmatl/pyopengl.git
pip install ./pyopengl

Specify PYOPENGL_PLATFORM before running the scriptis osmesa , as follows:

# demp.py
import os
# os.environ['PYOPENGL_PLATFORM'] = 'egl'
os.environ['PYOPENGL_PLATFORM'] = 'osmesa'

Note: os.environ[‘PYOPENGL_PLATFORM’] = ‘osmesa’ should ideally follow import os to ensure that PYOPENGL_PLATFORM is changed to osmesa before using render, or you can explicitly specify os.environ before using render specifically [‘PYOPENGL_PLATFORM’] = ‘osmesa’.

[Solved] VINS-MONO: integer_sequence_algorithm.h:64:21: error: ‘integer_sequence’ is not a member of ‘std’

The following problems are encountered when compiling vins-mono with catkin,

In file included from /usr/local/include/ceres/internal/parameter_dims.h:37,
                 from /usr/local/include/ceres/internal/autodiff.h:151,
                 from /usr/local/include/ceres/autodiff_cost_function.h:130,
                 from /usr/local/include/ceres/ceres.h:37,
                 from /home/matthew/projects/vinsmono/src/VINS-Mono/camera_model/src/calib/CameraCalibration.cc:20:
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:64:21: error: ‘integer_sequence’ is not a member of ‘std’
   64 | struct SumImpl<std::integer_sequence<T, N, Ns...>> {
      |                     ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:64:21: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:64:46: error: wrong number of template arguments (3, should be 1)
   64 | struct SumImpl<std::integer_sequence<T, N, Ns...>> {
      |                                              ^~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:60:8: note: provided for ‘template<class Seq> struct ceres::internal::SumImpl’
   60 | struct SumImpl;
      |        ^~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:64:49: error: expected unqualified-id before ‘>’ token
   64 | struct SumImpl<std::integer_sequence<T, N, Ns...>> {
      |                                                 ^~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:71:21: error: ‘integer_sequence’ is not a member of ‘std’
   71 | struct SumImpl<std::integer_sequence<T, N1, N2, Ns...>> {
      |                     ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:71:21: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:71:51: error: wrong number of template arguments (4, should be 1)
   71 | struct SumImpl<std::integer_sequence<T, N1, N2, Ns...>> {
      |                                                   ^~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:60:8: note: provided for ‘template<class Seq> struct ceres::internal::SumImpl’
   60 | struct SumImpl;
      |        ^~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:71:54: error: expected unqualified-id before ‘>’ token
   71 | struct SumImpl<std::integer_sequence<T, N1, N2, Ns...>> {
      |                                                      ^~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:78:21: error: ‘integer_sequence’ is not a member of ‘std’
   78 | struct SumImpl<std::integer_sequence<T, N1, N2, N3, N4, Ns...>> {
      |                     ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:78:21: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:78:59: error: wrong number of template arguments (6, should be 1)
   78 | struct SumImpl<std::integer_sequence<T, N1, N2, N3, N4, Ns...>> {
      |                                                           ^~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:60:8: note: provided for ‘template<class Seq> struct ceres::internal::SumImpl’
   60 | struct SumImpl;
      |        ^~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:78:62: error: expected unqualified-id before ‘>’ token
   78 | struct SumImpl<std::integer_sequence<T, N1, N2, N3, N4, Ns...>> {
      |                                                              ^~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:85:21: error: ‘integer_sequence’ is not a member of ‘std’
   85 | struct SumImpl<std::integer_sequence<T, N>> {
      |                     ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:85:21: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:85:41: error: wrong number of template arguments (2, should be 1)
   85 | struct SumImpl<std::integer_sequence<T, N>> {
      |                                         ^
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:60:8: note: provided for ‘template<class Seq> struct ceres::internal::SumImpl’
   60 | struct SumImpl;
      |        ^~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:85:42: error: expected unqualified-id before ‘>’ token
   85 | struct SumImpl<std::integer_sequence<T, N>> {
      |                                          ^~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:91:21: error: ‘integer_sequence’ is not a member of ‘std’
   91 | struct SumImpl<std::integer_sequence<T>> {
      |                     ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:91:21: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:91:38: error: template argument 1 is invalid
   91 | struct SumImpl<std::integer_sequence<T>> {
      |                                      ^
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:91:39: error: expected unqualified-id before ‘>’ token
   91 | struct SumImpl<std::integer_sequence<T>> {
      |                                       ^~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:135:31: error: ‘integer_sequence’ is not a member of ‘std’
  135 |                          std::integer_sequence<T, N, Ns...>,
      |                               ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:135:31: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:135:59: error: template argument 3 is invalid
  135 |                          std::integer_sequence<T, N, Ns...>,
      |                                                           ^
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:135:59: error: type/value mismatch at argument 4 in template parameter list for ‘template<class T, T Sum, class SeqIn, class SeqOut> struct ceres::internal::ExclusiveScanImpl’
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:135:59: note:   expected a type, got ‘N’
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:146:39: error: ‘integer_sequence’ is not a member of ‘std’
  146 | struct ExclusiveScanImpl<T, Sum, std::integer_sequence<T>, SeqOut> {
      |                                       ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:146:39: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:146:57: error: wrong number of template arguments (3, should be 4)
  146 | struct ExclusiveScanImpl<T, Sum, std::integer_sequence<T>, SeqOut> {
      |                                                         ^
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:130:8: note: provided for ‘template<class T, T Sum, class SeqIn, class SeqOut> struct ceres::internal::ExclusiveScanImpl’
  130 | struct ExclusiveScanImpl;
      |        ^~~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:160:53: error: ‘integer_sequence’ is not a member of ‘std’
  160 |       typename ExclusiveScanImpl<T, T(0), Seq, std::integer_sequence<T>>::Type;
      |                                                     ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:160:53: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:160:70: error: template argument 4 is invalid
  160 |       typename ExclusiveScanImpl<T, T(0), Seq, std::integer_sequence<T>>::Type;

After checking, it is generally caused by the incompatibility between Ceres-solver and eigen3. You can’t use the latest version of Ceres when running vins-mono.

I had no choice but to uninstall the previous version 2.0.0 first.

sudo rm -r /usr/local/lib/cmake/Ceres
sudo rm -rf /usr/local/include/ceres /usr/local/lib/libceres.a
sudo rm -r /usr/local/share/Ceres

Then download version 1.14.0 here,

http://ceres-solver.org/ceres-solver-1.14.0.tar.gz

wget ceres-solver.org/ceres-solver-1.14.0.tar.gz
https://ceres-solver.googlesource.com/ceres-solver
cd ceres-solver-1.14.0
mkdir build
cd build
cmake ..
make -j4
make test
sudo make install

Compile ceres_curve_fiiting
CD to ceres_curve_fiiting folder

 mkdir build
 cd build
 cmake ..
 make
 ./curve_fitting

Compilation finished!

[Solved] Open3d error: unable to display image using open3d

Error Messages:

ibGL error: MESA-LOADER: failed to open radeonsi: /usr/lib/dri/radeonsi_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: radeonsi
libGL error: MESA-LOADER: failed to open radeonsi: /usr/lib/dri/radeonsi_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: radeonsi
libGL error: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: swrast

Solution:
The computer may use the independent display + integrated display at the same time, and switch to the independent display mode.

[Solved] RuntimeError: 1only batches of spatial targets supported (non-empty 3D tensors) but got targets of s

catalogue

An error is reported when running unet3 + for multi classification training

RuntimeError: 1only batches of spatial targets supported (non-empty 3D tensors) but got targets of size xxx

1. Modify train.py

2. Modify predict.py

3. Modify eval.py

Then run the following statement to start the training:

[experiment record] u-net (pytorch)


An error is reported when running unet3 + for multi classification training

RuntimeError: 1only batches of spatial targets supported (non-empty 3D tensors) but got targets of size xxx

After many times of reference, trial and error, the following solutions are obtained:

Unet3 + source code has a small bug for multi classification tasks, which is slightly modified here. (unet3 + code comes from githubgithub – avbuffer/unet3plus_pth: unet3 +/UNET + +/UNET, used in deep automatic portal matching in Python)

1. Modify train.py

# line 56
if net.n_classes > 1:
        criterion = nn.CrossEntropyLoss()  
    else:
        criterion = nn.BCEWithLogitsLoss()

# line 79
loss = criterion(masks_pred, torch.squeeze(true_masks))   

# line 153
net = UNet(n_channels=3, n_classes=3)   

The reason for using the torch. Squeeze() function is that when crossentropy is used as the loss function, the output of output = net (input) should be [batchsize, n_class, height, weight], while the label is [batchsize, height, weight], and the label is a single channel gray map; Both bceloss and cross-entropy loss are used for classification problems. Bceloss is a special case of cross-entropy loss, which is only used for binary classification problems, and cross-entropy loss can be used for binary classification or multi-classification.

NN. Crossentropyloss() function to calculate cross entropy loss example:

Use.
# output is the output of the network, size=[batch_size, class]
# If the batch size of the network is 128 and the data is divided into 10 classes, then size=[128, 10]
 
# target is the real label of the data, which is scalar, size=[batch_size]
# If the batch size of the network is 128, then size=[128]
 
criterion=nn.CrossEntropyLoss()
crossentropyloss_output=criterion(output,target)

2. Modify predict.py

os.environ['CUDA_VISIBLE_DEVICES'] = str(gpu_id)
if unet_type == 'v2':
    net = UNet2Plus(n_channels=3, n_classes=1)
elif unet_type == 'v3':
# line93
    net = UNet3Plus(n_channels=3, n_classes=20)   
    #net = UNet3Plus_DeepSup(n_channels=3, n_classes=1)
    #net = UNet3Plus_DeepSup_CGM(n_channels=3, n_classes=1)
else:
    net = UNet(n_channels=3, n_classes=1)

3. Modify eval.py

for true_mask, pred in zip(true_masks, mask_pred):
    pred = (pred > 0.5).float()
    if net.n_classes > 1:
# line26
    tot += F.cross_entropy(pred.unsqueeze(dim=0), true_mask).item()
    # tot += F.cross_entropy(pred.unsqueeze(dim=0), true_mask.unsqueeze(dim=0)).item()
    else:
        tot += dice_coeff(pred, true_mask.squeeze(dim=1)).item()

Then run the following statement to start the training:

python train.py -g 0 -u v3 -e 400 -b 2 -l 0.1 -s 0.5 -v 15.0

Solution to prompt resource error when opening DAZ studio

        If you install DAZ studio through DAZ central and open it, you will be prompted with resource error

A valid PostgreSQL CMS connection could not be established. Several DAZ Studio features that require a valid PostgreSQL CMS connection,such as context aware content views and loading content installed using the Daz Connect service,will not be available.Check your network,anti-virus,and firewall settings for onflicts.

I solved it through the following methods. You can also try it

1. In dazcentral

Select uninstall to uninstall DAZ studio,

 

After the uninstall is successful, click Install to reinstall

  2. After reinstallation, click open to open DAZ studio, and click the icon on the left of the viewport

  After clicking the icon, a menu will pop up,

 

Then click the second item of the menu, content DB maintenance, and a small window will pop up, as shown in the following figure

  Then check the reset database item,

Then click accept to reset the database,

Close DAZ studio,

Reopen,

It will display the welcome window without login prompt before,

After logging in, click next in the lower right corner of the window

There will be no resource error prompt

Uncaught Error: THREE.OBJLoader : unexpected line: “DOCTYPE HTML” [solved]

Today’s problem really makes me despair. What you netizens say is that it’s OK to put it under static, but I can’t do it here 😥
Then I found that I had a static folder under public. After testing, I found that it was really static under public….
The code can still be written as usual

summary
obj file is put under public/static
questions
but why I don’t understand?If you know, please leave a message in the comment area 😁

How does lightningchart, a high performance chart control, draw maps in 3D?

LightningChart is primarily a charting component (charts are graphical representations of data) rather than a virtual environment creation tool. However, LightningChart provides multiple ways to use geographic maps, not only in 2D, but also in 3D.
If you are primarily interested in 3D maps, Artion can provide three examples of possible ideas. First, you can import a map/image into a “chart” and create a surface whose geometry and color are based on map elements (such as shading). Example of this type in ExampleArgesurface:

Example large surface
As shown in ExampleGlobal Surface3D, such a surface can be wrapped in any shape

Example Globesurface3D
You can also use the information/data from the map (for example, boundary residents, population size, etc.) to create Chart 3D objects (which can be pointlineseries3D, meshModel, polygon3D, etc.). In ExamplePopulationPolygons3D demonstrates a kind of such a method.

Example population polygon 3D
LightningChart.net is fully GPU-accelerated and optimized for displaying massive amounts of data in real time — over 1 billion data points. LightningChart includes a wide range of 2D, Advanced 3D, Polar, Smith, 3D Pake/Doughnut, Geographic Maps and GIS charts as well as volume mapping capabilities for science, engineering, medicine, aviation, trade, energy and other fields.

[learning opengl 22 step by step] – OpenGL importing 3D models with assimp Library

Tutorial 22
OpenGL imports 3D models using the ASSIMP library

Original: http://ogldev.atspace.co.uk/www/tutorial22/tutorial22.html
CSDN full version column: http://blog.csdn.net/column/details/13062.html


background
Through the previous learning we have achieved a lot of good results, but we are not good at creating complex models, you can imagine through the code to define every vertex position and other properties of the object is not feasible. A box, pyramid or simple surface mapping is fine, but what about a three-dimensional face?In fact, in games, in some commercial game applications, the mesh of the model is created by artists using modeling software such as Blender,Maya,3ds Max, etc. These software provide powerful tools to help artists create complex models. After the model is created, it is saved into a file. 3D model files are available in many formats, such as OBJ format. The 3D model file contains the entire geometry definition of the model, which can then be imported into the game engine (if the game engine can, of course)