spoonsso / dannce

MIT License
213 stars 30 forks source link

Label3D traingulation error #111

Closed SEONGGAP closed 2 years ago

SEONGGAP commented 2 years ago

Hi. I am setting up dannce, but there is problem with triangulation in Label3D. I calibrated my camera with checkerboard and L-frame, and it looks successful. image

Than, I run Label3D using example.m. After labeling EarL, EarR, Snout, I pressed 't' key for triangulation and I got error.

image

The error message is below, but I cannot find problems.

Error using cameraIntrinsics>parseInputsSimulation (line 270) The value of 'principalPoint' is invalid. Expected principalPoint to be positive.

Error in cameraIntrinsics>parseInputs (line 248) r = parseInputsSimulation(defaultParams,varargin{:});

Error in cameraIntrinsics (line 122) r = parseInputs(varargin{:});

Error in vision.internal.calibration.CameraParametersImpl/get.Intrinsics (line 421) intrinsics = cameraIntrinsics(this.FocalLength, ...

Error in Label3D>@(X)X.Intrinsics (line 620) intrinsics = cellfun(@(X) X.Intrinsics, obj.cameraParams,'uni',0);

Error in Label3D/triangulateLabeledPoints (line 620) intrinsics = cellfun(@(X) X.Intrinsics, obj.cameraParams,'uni',0);

Error in Label3D/keyPressCallback (line 851) obj.triangulateLabeledPoints(obj.frameInds(obj.frame));

Error in Animator.runAll (line 255) keyPressCallback(h{i},src,event)

Error in Label3D>@(src,event)Animator.runAll(obj.getAnimators,src,event) (line 983) obj.Parent.WindowKeyPressFcn = @(src,event) Animator.runAll(obj.getAnimators,src,event);

Error while evaluating Figure WindowKeyPressFcn.

Could you give me an advise for sloving this problems.

Thanks.

spoonsso commented 2 years ago

I believe this is due to a bad intrinsics fits for one of your cameras. Can you check the intrinsic marrices for each of them? Check the first two entries in the bottom row of each matrix. https://www.mathworks.com/help/vision/ug/camera-calibration.html

SEONGGAP commented 2 years ago

Thank you for reply.

I recorded checkerboard videos with a plexiglass cylinder context. It may cause an error, I missed 'some tips' in 'dannce\README.md'.

I will try to calibrate without out context.

Thanks.

SEONGGAP commented 2 years ago

image

Thanks to your comment, there is no triangulation error. Now, I am trying to recalibrate for improving accuracy of the triangulation.

Thanks.

SEONGGAP commented 2 years ago

Hi. @spoonsso Thanks to your comments I successfully labeled via Label3D 16 skeletons. And then, I did com-train (fintuning your weights.rat.COM.hdf5), and com-predict for running dannce.

Now, I have problems in dannce-train. I tried finetuning weights/weights.rat.MAX/ from markerlessmouse1. But, I got a same error in issue #50 and I changes parameters (n_channels_out, augment_brightness_val, augment_continuous_rotation) followed the answer of the issue, and I cannot fix it.

Error message :

Could not load weights for finetune (likely because you are finetuning a previously finetuned network). Attempting to finetune from a full finetune model file. Traceback (most recent call last): File "c:\windows\system32\dannce\dannce\interface.py", line 1120, in dannce_train fargs File "c:\windows\system32\dannce\dannce\engine\nets.py", line 1129, in finetune_AVG model = renameLayers(model, weightspath) File "c:\windows\system32\dannce\dannce\engine\nets.py", line 1348, in renameLayers model.load_weights(weightspath, by_name=True) File "C:\ProgramData\Anaconda3\envs\dannce\lib\site-packages\tensorflow\python\keras\engine\training.py", line 2209, in load_weights f, self.layers, skip_mismatch=skip_mismatch) File "C:\ProgramData\Anaconda3\envs\dannce\lib\site-packages\tensorflow\python\keras\saving\hdf5_format.py", line 759, in load_weights_from_hdf5_group_by_name layer, weight_values, original_keras_version, original_backend) File "C:\ProgramData\Anaconda3\envs\dannce\lib\site-packages\tensorflow\python\keras\saving\hdf5_format.py", line 403, in preprocess_weights_for_loading weights[0] = np.transpose(weights[0], (3, 2, 0, 1)) File "<__array_function__ internals>", line 6, in transpose File "C:\ProgramData\Anaconda3\envs\dannce\lib\site-packages\numpy\core\fromnumeric.py", line 651, in transpose return _wrapfunc(a, 'transpose', axes) File "C:\ProgramData\Anaconda3\envs\dannce\lib\site-packages\numpy\core\fromnumeric.py", line 61, in _wrapfunc return bound(args, **kwds) ValueError: axes don't match array

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\ProgramData\Anaconda3\envs\dannce\Scripts\dannce-train-script.py", line 33, in sys.exit(load_entry_point('dannce', 'console_scripts', 'dannce-train')()) File "c:\windows\system32\dannce\dannce\cli.py", line 66, in dannce_train_cli dannce_train(params) File "c:\windows\system32\dannce\dannce\interface.py", line 1126, in dannce_train *fargs File "c:\windows\system32\dannce\dannce\engine\nets.py", line 1201, in finetune_fullmodel_AVG compile=False, File "C:\ProgramData\Anaconda3\envs\dannce\lib\site-packages\tensorflow\python\keras\saving\save.py", line 182, in load_model return hdf5_format.load_model_from_hdf5(filepath, custom_objects, compile) File "C:\ProgramData\Anaconda3\envs\dannce\lib\site-packages\tensorflow\python\keras\saving\hdf5_format.py", line 175, in load_model_from_hdf5 raise ValueError('No model found in config file.') ValueError: No model found in config file.

This is io and config files that I used for danne-train. io.txt dannce_rat_config.txt

Thanks.

data-hound commented 2 years ago

Moving the discussion to #121. Closing this issue