aildnont / covid-cxr Goto Github PK
View Code? Open in Web Editor NEWNeural network model for classifying chest X-rays by presence of COVID-19 features
License: MIT License
Neural network model for classifying chest X-rays by presence of COVID-19 features
License: MIT License
First of all thanks for your effort. When I tried to run the preprocess.py I got the following and the run stop. How can I handle this, please?
preprocess.py:104: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
mila_covid_views_df['label'] = class_dict['COVID-19']
preprocess.py:107: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
mila_views_pneum_df['label'] = class_dict['other_pneumonia'] # Mila CXRs with other peumonias
preprocess.py:110: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
fig1_covid_views_df['label'] = class_dict['COVID-19']
while running lime_explain.py I encountered the following error :
Traceback (most recent call last):
File ".\src\interpretability\lime_explain.py", line 116, in <module>
explain_xray(lime_dict, i, save_exp=True) # Generate explanation for image
File ".\src\interpretability\lime_explain.py", line 83, in explain_xray
orig_img = cv2.resize(orig_img, new_dim, interpolation=cv2.INTER_NEAREST) # Resize image
cv2.error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\imgproc\src\resize.cpp:3718: error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize'
I tried to enclose it into a try-catch block, It skips some images but in subsequent files, the error arises. Like
error: (-209:Sizes of input arguments do not match) The operation is neither 'array op array' (where arrays have the same size and the same number of channels), nor 'array op scalar', nor 'scalar op array' in function 'cv::arithm_op'
I run train.py file and get this error no output_class_indices.pkl can you help me
Hello,
I am running this project on colab. I trained and tested the model on local machine. All stage (training, lime_explanation, batch prediction) are working fine on local machine. On colab training and lime_explanation are working fine. But this error arises during batch prediction stage. The model predicts given image but error arises during explanation stage in predict.py. I have already tried different version of lime in colab.
Found 5 validated image filenames.
Predicting and explaining examples.
100% 1000/1000 [00:06<00:00, 148.94it/s]
---------------------------------------------------------------------------
SystemError Traceback (most recent call last)
<ipython-input-1-d9a893551efa> in <module>()
159 if __name__ == '__main__':
160 #preds_dir = '/content/final/testImages'
--> 161 results = predict_and_explain_set(preds_dir=None, save_results=True, give_explanations=True)
4 frames
<ipython-input-1-d9a893551efa> in predict_and_explain_set(raw_img_dir, preds_dir, save_results, give_explanations)
133 # Explain this prediction
134 if give_explanations:
--> 135 explanation, _ = predict_and_explain(np.squeeze(x, axis=0), model, explainer, NUM_FEATURES, NUM_SAMPLES)
136 if cfg['LIME']['COVID_ONLY'] == True:
137 label_to_see = class_indices['COVID-19']
<ipython-input-1-d9a893551efa> in predict_and_explain(x, model, exp, num_features, num_samples)
53
54 # Generate explanation for the example
---> 55 explanation = exp.explain_instance(x, predict, num_features=num_features, num_samples=num_samples, segmentation_fn=segmentation_fn)
56 probs = predict_instance(np.expand_dims(x, axis=0), model)
57 return explanation, probs
/usr/local/lib/python3.6/dist-packages/lime/lime_image.py in explain_instance(self, image, classifier_fn, labels, hide_color, top_labels, num_features, num_samples, batch_size, segmentation_fn, distance_metric, model_regressor, random_seed)
216 data, labels, distances, label, num_features,
217 model_regressor=model_regressor,
--> 218 feature_selection=self.feature_selection)
219 return ret_exp
220
/usr/local/lib/python3.6/dist-packages/lime/lime_base.py in explain_instance_with_data(self, neighborhood_data, neighborhood_labels, distances, label, num_features, feature_selection, model_regressor)
180 """
181
--> 182 weights = self.kernel_fn(distances)
183 labels_column = neighborhood_labels[:, label]
184 used_features = self.feature_selection(neighborhood_data,
/usr/local/lib/python3.6/dist-packages/lime/lime_image.py in kernel(d, kernel_width)
118 if kernel is None:
119 def kernel(d, kernel_width):
--> 120 return np.sqrt(np.exp(-(d ** 2) / kernel_width ** 2))
121
122 kernel_fn = partial(kernel, kernel_width=kernel_width)
SystemError: unknown opcode
Running preprocess.py
results in the following warning:
./src/data/preprocess.py:91: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
mila_other_views_df['label'] = 0 # Mila images with alternative diagnoses
./src/data/preprocess.py:92: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
fig1_covid_views_df['label'] = 1 # Figure 1 images with COVID-19 diagnosis
i am getting this error :
class_ids = list(sorted(class_weight.keys())) AttributeError: 'list' object has no attribute 'keys'
pls help me to fix this
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.