Issue What is the Python equivalent of Matlab’s tic and toc functions? Solution Apart from timeit which ThiefMaster mentioned, a simple way to do it is just (after importing time): t = time.time() # do stuff elapsed = time.time() –
Continue readingTag: matlab
Not getting a new line when using fprintf
Issue I wrote a small function for the pyhtagorean value: function c = pyth(a,b) % Takes two inputs of same size and returns the pythagorean of the 2 inputs if size(a) == size(b) % checks for same size c =
Continue readingSelf Organizing Map to split datasets
Issue I am trying to use Self Organizing Map to split datasets into training, validation and test sets. I created the SOM model, dimension1 = 10; dimension2 = 10; net = selforgmap([dimension1 dimension2],100,3,’hextop’,’linkdist’); [net, tr] = train(net, cancer); however when
Continue readingRearrange array into a form suitable for NN training
Issue I am working on a large dataset that I need to convert to a specific format for further processing. I am looking for advice in this regard. Sample input: A = [0.99 -0.99 1 -1 0.55 -0.55] Sample output:
Continue readingCorrect practice and approach for reporting the training and generalization performance
Issue I am trying to learn the correct procedure for training a neural network for classification. Many tutorials are there but they never explain how to report for the generalization performance. Can somebody please tell me if the following is
Continue readingDefining custom syntax highlighting for Atlassian Fisheye/Crucible: MATLAB
Issue I am using Atlassian Fisheye/Crucible (“fecru”) for MATLAB code review and fecru is obviously missing a syntax scheme support for matlab code. Apparently there is a mechanism to support a user-defined scheme, one just has to place it into
Continue readingSetup Sublime Text or alternative editor for Matlab?
Issue I did not find any suitable answer or hint, so I am asking this here now: Is there any alternative editor for Matlab with a dark theme (easier to the eyes), that supports integration in Matlab for proper debugging,
Continue reading(Matlab) Strange precision loss, while assigning Complex-matrix to local variable
Issue I’m getting this unexpected (and seems to be non-complaint) floating-point precision loss, specifically of Complex values, when storing an expression into a local variable, the same statement runs correctly in a ‘script’ scope (currently testing on Matlab-2018a Linux, seems
Continue readingDifference between the cost function of a training sample and the cost function of a mini-batch
Issue Lets say that I have a neural network named ‘NN’ with 500 weights and biases (total parameters=500). For one training sample: It’s introduced through ‘NN’, it spits out an output (Out1), the output is compared to the training label,
Continue readingK-fold Cross-Validation – initialise network after each fold or not?
Issue I mostly understand how k-fold cross-validation works and have begun implementing it into my MATLAB scripts, however I have two questions. When using it to select network features (hidden units, weight decay prior and no. iterations in my case).
Continue readingEvery time I train my CNN on matlab, is it remembering the old weights from the previous time I trained it? Or does it reset them?
Issue So for example, I have trained a CNN on my data using a learning rate of 0.0003 and 10 epochs, with a minibatch size of 32. After training it, lets say I get an accuracy of 0.7. Now I
Continue readingIs there any Difference of Gaussians function in Matlab?
Issue I am new to Image Processing, and in my experiment I am having difficulty with Difference of Gaussians. Various implementation were given to me but I don’t understand them and their parameters. Here are my formulas Should I implement
Continue readingArmadillo porting imagesc to save image bitmap from matrix
Issue I have this matlab code to display image object after do super spectrogram (stft, couple plca…) t = z2 *stft_options.hop/stft_options.sr; f = stft_options.sr*[0:size(spec_t,1)-1]/stft_options.N/1000; max_val = max(max(db(abs(spec_t)))); imagesc(t, f, db(abs(spec_t)),[max_val-60 max_val]); And get this result: I was porting to C++
Continue readingIssues in encrypting a string in binary form and embed in image matlab
Issue I was working on a project that encrypts a string and embeds it in the image, how I do is by making it binary. My program fully worked when I generated random data using the rand() function, but when
Continue readingCT projection (distance-driven) operator implementation?
Issue I am trying to use MATLAB to implement a CT (computed tomography) projection operator, A, which I think is also referred as “system matrix” often times. Basically, for a N x N image M, the projection data, P, can
Continue readingApplying MATLAB's idwt2 several times
Issue I am using MATLAB to apply the Discrete Wavelet Transform on an image. I am applying it several times (3) in order to get a 3 level transform. I am using the dwt2 function provided by MATLAB in order
Continue readingError trying to manually create Gaussian Filter in Python
Issue I created a Python code based on a MATLAB code I already had to implement the Gaussian Filter. But when I run the project, I get the following error: Traceback (most recent call last): File "C:\Users\gisla\Scilab_PDI\gaussianFilter.py", line 37, in
Continue readingHow to prune some unnecessary branches from the Voronoi diagram?
Issue I generated the Voronoi diagram using the following MATLAB code. The problem is that in the output image I obtain some useless lines that I want to remove. By useless lines, I mean like those circled in purple, so
Continue readingFinding the edges of a partial ellipse in an image
Issue I have an binary image as shown below. As can be seen in the image there is an edge which looks like an arc of an ellipse, as illustrated below and I manually marked it as red. These red
Continue readingHow to read .tif style images from a directory
Issue I am trying to run the following code to analyze multiple .tif images in several different directories. Upon running the code, the figures that are given are blank, followed by the error on line 49 "M must be provided
Continue readingApplying histeq function to 3×3 blocks
Issue I divided the cameraman.tif to 3×3 blocks and I want to apply histeq function to all of these 3×3 blocks and trying to get a new image. I need a help with histogram equalization of these 3×3 blocks on
Continue readingIssue reproducing MATLAB's imfilter function
Issue I am trying to understand how MATLAB’s imfilter function works. im = imread("cameraman.tif"); % Kernel for sharpening the image kernel = [ 0 -1 0; -1 5 -1; 0 -1 0]; im2 = zeros(size(im)); for y = 1 :
Continue readingZero padding fourier of image
Issue I’m trying to solve a question, given an image f(x,y) at size N,M with fourier transform F. we define function g, which its fourier transform G is define as follows: G(x,y)=F(x,y) if x which means that we pad the
Continue readingHow to obtain the coordinates in a MATLAB image as I move the cursor of the mouse on it?
Issue I have obtained the following image (which is a binary). I would like to know if there is a way to get the coordinates of the pink lines in the MATLAB plot, so that as I move the mouse
Continue readingPython equivalent to Matlab funciton 'imfill' for grayscale?
Issue Is there an implementation using OpenCV or scikit-image that is equivalent to Matlab’s grayscale image imfill funciton (i.e. grayscale hole filling)? See the imfill section for grayscale (I2= imfill(I)) in the following example link matlab_imfill. Or see image: matlab_tire_ex
Continue readinglocal histogram equalization in matlab / python
Issue i am very new in matlab. i want to write the code for local histogram equalization . i have been written code for global histogram equalization and i know that local equalization means do equalization for each part of
Continue readinghow to detect partial corrupted images in Jpg/Jpeg format
Issue In a very big image dataset, we have some corrupted images as following images. These images can be viewed without any problem, but human eyes can see some corrupted areas in gray color. How can I detect these corrupted
Continue readingBlockproc like function for Python image processing
Issue edit: it’s an image so the suggested (How can I efficiently process a numpy array in blocks similar to Matlab's blkproc (blockproc) function) isn’t really working for me I have the following matlab code fun = @(block_struct) … std2(block_struct.data)
Continue readingHow to create range of numbers in Python like in MATLAB
Issue Is there any way to create a range of numbers in Python like MATLAB using a simple syntax, i.e, not using loops. For example: MATLAB: a = 1:0.5:10 give a = [1 1.5 2 2.5 3 3.5 …. 9.5
Continue reading