Code Monkey home page Code Monkey logo

covid-cxr's People

Contributors

aildnont avatar bvanberl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

covid-cxr's Issues

SettingWithCopyWarning

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']

openCV error

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'

lime library issue (unknown opcode) on colab

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

Preprocess.py throws SettingWithCopyWarning

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

getting error in train.py

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.