I trained a neural network model on Digits and it seemed to run fine there.
Then i exported the trained model files and copied them into a different system running the standard caffe web demo.
I hoped to just be able to plug those files in and have them run in Caffe but i am getting an error.
Specifically I copied my model into bvlc_reference_caffenet.caffemodel, the deploy.prototxt into deploy.prototxt, and the mean.binaryproto into the ilsvrc_2012_mean.npy file.
However when I try to run it , it appears to not like the format of the mean.binaryproto file as indicated by the error message:
IOError: Failed to interpret file '/home/vagrant/caffe/python/caffe/imagenet/ilsvrc_2012_mean.npy' as a pickle
what am I doing wrong here? Do I need to process the mean.binaryproto file from Digits somehow before I use it with caffe?
You need to convert the .binaryproto file to a numpy file.
There is a nice example here using caffe.io and caffe.proto.
Related
I have a HU submodels FMU that is not running in a Simulink model.
I use Matlab2020b, FMIkit2.7 and the FMU created with Amesim 2019.1.
This is the error message:
AME_LIC_CACHE_INIT set to 100
Impossible to open file 'pV/pV_FrontAxle_Variant1.txt'.
Impossible to open file 'pV/pV_FrontAxle_Variant1.txt'.
Fatal error in FXA001 instance 1.
Terminating the program.
Simcenter Amesim model: initialization failed.
Failed to exit initialization mode
Failed to exit initialization mode. The FMU crashed (exception code: UNKOWN_EXEPTION_CODE).
I give 2 parameter in .txt file for the FXA001. It is worked in older versions of the model.
I tried to give the full path, copy the files to the folder where the model was and still not found.
Has anyone ever had such an issue?
Thank you!
Based on my experience, this issue might happen if the two text files do not have a header mentioning the Amesim table format they use.
For example for a so-called ā1Dā table:
#Table format: 1D
Otherwise the files may not be embedded properly when exporting the FMU.
I am training a Neural Network model with pytorch.
Since this model is very complicated, I made use of the pytorch_xla package to use TPU. I finished training the model and now I want to save the weight so I will be able to use them from any envrionment.
I tried to save the data like so
file_name = "model_params"
torch.save(model.state_dict(), file_name)
and when I tried to load them (from environment which does not support TPU)
model.load_state_dict(torch.load(file name))
I got the following error
NotImplementedError: Could not run 'aten::empty_strided' with arguments from the 'XLA' backend. This could be because the operator doesn't exist for this backend, or was omitted during the selective/custom build process (if using custom build). If you are a Facebook employee using PyTorch on mobile, please visit https://fburl.com/ptmfixes for possible resolutions. 'aten::empty_strided' is only available for these backends: [CPU, Meta, BackendSelect, Named, ADInplaceOrView, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, UNKNOWN_TENSOR_TYPE_ID, AutogradMLC, AutogradHPU, AutogradNestedTensor, AutogradPrivateUse1, AutogradPrivateUse2, AutogradPrivateUse3, Tracer, Autocast, Batched, VmapMode].
Is there a way to do what I want?
I tried to use distilbert classifier. but I am getting the following error.
This is my code
(X_train,y_train),(X_test,y_test),prepro
=text.texts_from_df(train_df=data_train,text_column="Cleaned",label_columns=col
,val_df=data_test,maxlen=500,preprocess_mode="distilbert")
and here is the error
OSError: Model name 'distilbert-base-uncased' was not found in tokenizers model name list (distilbert-base-uncased, distilbert-base-uncased-distilled-squad, distilbert-base-cased, distilbert-base-cased-distilled-squad, distilbert-base-german-cased, distilbert-base-multilingual-cased). We assumed 'distilbert-base-uncased' was a path, a model identifier, or url to a directory containing vocabulary files named ['vocab.txt'] but couldn't find such vocabulary files at this path or url._
Due to my office current environmental issue, I can only work on tf 2.2 and python 3.8. Right now I am using 0.19.
Do you think it will affect my current environment if I downgrade it to 0.16?
This error may happen if there is a network or firewall issue preventing download of the tokenizer files. See this FAQ entry for remedies.
Also, when you use preprocess_mode='distilbert', texts_from* functions return TransformerDataset instances, not arrays. You'll need to replace (X_train, y_train) with train_data, for example. See this example notebook.
Currently working on a Fully CNN for renal segmentation in MR images. Have 40 images and their ground truth labels, attempting to load all of the images for pre-processing purposes.
Using Google Colab, with the latest versions of pydicom and pip installed, for this project. Currently have the Google Drive mounted to the Colab program and the code below shows the correct pathways to the images and their masks in the pydicom.read_file() and cv2.imread() calls, respectively.
However, when I use the "/../IMG*.dcm" or "/../IMG*.png" file paths (which should be legal?), I receive a "FileNotFoundError" as listed below. But, when I specify a specific .dcm or .png image, the pydicom.read_file() and cv2.imread() calls function quite normally.
Any suggestions on how to resolve this issue? I am struggling a lot with loading the data and pre-processing but have the model architecture ready to go once these preliminary hurdles are overcome.
#import data as data
import pydicom
import numpy as np
images= pydicom.read_file("/content/drive/My Drive/CHOAS_Kidney_Labels/Training_Images/T1DUAL/IMG*.dcm");
numpyArray = images.pixel_array
masks= cv2.imread("/content/drive/My Drive/CHOAS_Kidney_Labels/Ground_Truth_Training/T1DUAL/IMG*.png");
-----> FileNotFoundError: [Errno 2] No such file or directory: '/content/drive/My Drive/CHOAS_Kidney_Labels/Training_Images/T1DUAL/IMG*.dcm'
pydicom.read_file does not support wildcards. You have to iterate over the files yourself, something like (untested):
import glob
import pydicom
pixel_data = []
paths = glob.glob("/content/drive/My Drive/CHOAS_Kidney_Labels/Training_Images/T1DUAL/IMG*.dcm")
for path in paths:
dataset = pydicom.dcmread(path)
pixel_data.append(dataset.pixel_array)
I have Orange3 installed with Python 2.7 32-bit on a Windows 10 OS. Everything seems to work okay and I have trained a Classification Tree and now want to save the model. When I add the Save Classifier widget and connect it to the Classification Tree, I cannot enter a File name. I've tried retraining the model with the Save Classifier widget attached, but still nothing. I have a Classification Tree Viewer attached and it works fine okay. Any suggestions on how I can create a .pickle file of my Classification Tree?
I figured out how to save a .pickle file with the Save Classifier. I "primed" the directory with a file I renamed to have the file type .pickle. Then the Orange Save Classifier allowed me to search and find this existing .pickle file and overwrite it. It works fine now.