Is there any MRI sample data in numpy? - numpy

I would like to try some examples on MRI data on MRI, does Numpy has some MRI sample data?

Related

How to convert numpy array to Open3D Image in python?

I use image_transport pkg in ROS to transport numpy arrays (from OpenCV) to a listener written in python.
Now I want to convert a numpy array (from OpenCV) to Open3D Image data structure. How can I write this conversion? Is there any method that Open3D already have to finish this job?

Tensorflow dataset api

I am reading CSV file using tf.contrib.data.make_csv_dataset(csv_path), the CSV has 2 columns namely review and rating. What I want to perform tokenization on review column after reading .
dataset = tf.contrib.data.make_csv_dataset(csv_file, batch_size=2)
After creating dataset, I want my map below method to dataset for review column:
def create_tokens(sentence):
return tf.string_split([sentence).values
I am stuck here.
With this example data:
review, rating
Best film ever, 5
rather meh, 2
You should be able to use tf.data.map() as explained here and here in tensorflow 1.10:
def create_tokens(sentence):
return tf.string_split(sentence['review'])
dataset = tf.contrib.data.make_csv_dataset('test.csv', batch_size=2)
dataset = dataset.map(create_tokens)

How to get python to generate the tweedie deviance for xgboost?

Using statsmodel's GLM, the tweedie deviance is included in the summary function, but I don't know how to do this for xgboost. Reading the API didn't help either.
In Python this is how you do it. Suppose predictions is the result of your gradient boosted tree and real are the actual numbers. Then using statsmodels you would run this:
import statsmodels as sm
dev = sm.families.Tweedie(pow_var=1.5).deviance(predictions, real)

How to load and convert .mat file into numpy 2D array?

I have a data in mat file (observations and features) and i want to load it into numpy 2D array. I dont want to convert it into csv first and then load csv into numpy.
Use scipy's loadmat (API-docs).
The docs should be sufficient to get you going, but make sure to read the notes.
There is also the io-tutorial with some examples.

Feature request: NumPy Reader

I have a large collection of NumPy arrays saved on disk. I would like to read them efficiently and concurrently with the training. I can't load them all into memory at once - the data set is too large.
Additionally, it would be nice to apply some user defined transforms on the fly. Also it would be nice to be able to read them from C++, not just Python.
I believe CNTK does not have this capability now, am I correct?
Currently, we don't have build-in numpy reader. However, you have multiple options:
Read the numpy data in batches and feed them to the trainer, here an example that read images into numpy array and feed it to the trainer:
https://github.com/Microsoft/FERPlus
What the data inside your numpy array? Can you convert it to a format readable by one of the CNTK readers?