hfawaz/miccai18

invalid syntax

Closed this issue · 7 comments

HHIR commented

Dear Weber and Forestier,

Your article is so interesting.
I'm trying to run the code's, but there are some problems with the syntax error.
like:

File "miccai2018.py", line 256
    class_activation_map(time_series_original,original_binary_class,model,path_to_images+surgery_name+'__'+str(f'{i:06}')+'.png',max_frame=i+1,slave_manipulator=slave_manipulator,angle=15*6,elev=75+180)
                                                                                                                       ^
SyntaxError: invalid syntax
File "miccai2018.py", line 261
    os.system('ffmpeg -f image2 -framerate 30 -i '+path_to_images+surgery_name+'__%06d.png -s 640x480 '+ path_to_video+surgery_name+slave_manipulator+'.mp4')
     ^
IndentationError: expected an indented block

Do you know what should be the problem?
I looking forward to hearing from you.
All the best

HHIR commented

@JjmWeber @forestier
I fixed the problem by installing python3.6, but after running the code, I will get this result:

$ python3.6 miccai2018.py
Using TensorFlow backend.
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcublas.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcudnn.so.5 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcufft.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcurand.so.8.0 locally
Number of different surgeries in total: 39
miccai2018.py:194: FutureWarning: Method .as_matrix will be removed in a future version. Use .values instead.
  matrix = confusion_matrix.as_matrix()
miccai2018.py:209: RuntimeWarning: invalid value encountered in true_divide
  res = matrix.diagonal()/np.sum(matrix,axis=1)
miccai2018.py:206: RuntimeWarning: invalid value encountered in double_scalars
  return sum(matrix.diagonal()) / np.sum(matrix)
     N    I    E
N  0.0  0.0  0.0
I  0.0  0.0  0.0
E  0.0  0.0  0.0
--- 7.115549325942993 seconds ---
End!

Dear @Hosseinhashemiir,

Thank you for your interest in our work.

For the first error you were receiving, I think it is due to the f-string method we are using.

This is a new feature introduced in python3.6 so you should try running the program with 3.6 or comment the f-string lines if you want to use an older of python3.

As for the result you are receiving in your second comment, did you download the JIGSAWS.zip from the corresponding website and unzipped it in the current working directory of the repository ?

Waiting for your response and glad to help.

HHIR commented

@hfawaz

Thank you for your kindly attention.
I can't find JIGSAWS.zip on the JIGSAWS website. I just downloaded the dataset which was divided to
Knot-Tying, Needle-Passing, Suturing, Experimental-setup, file's which possible to download each one by self [ not in the one zip file]

Hello @Hosseinhashemiir

I am not aware of any other source than the JIGSAWS' official website, thus I do not know if other zip files would work with the code on this repository.

I guess you can send them an email asking for the dataset or just fill their form to ask for the dataset (the form is available on this link).

I hope you understand that for copyright reasons we cannot share the dataset, since it is not ours to distribute.

Let me know if there is anything else I can help you with.

HHIR commented

right now, it seems running well.
but could you please give me information about the training time?

Using TensorFlow backend.
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcublas.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcudnn.so.5 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcufft.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcurand.so.8.0 locally
Number of different surgeries in total: 39
train size:23
val size:8
test size:8
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:910] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
I tensorflow/core/common_runtime/gpu/gpu_device.cc:885] Found device 0 with properties:
name: GeForce GT 740M
major: 3 minor: 5 memoryClockRate (GHz) 1.0325
pciBusID 0000:07:00.0
Total memory: 1.96GiB
Free memory: 1.76GiB
I tensorflow/core/common_runtime/gpu/gpu_device.cc:906] DMA: 0
I tensorflow/core/common_runtime/gpu/gpu_device.cc:916] 0: Y
I tensorflow/core/common_runtime/gpu/gpu_device.cc:975] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GT 740M, pci bus id: 0000:07:00.0)
I tensorflow/core/common_runtime/gpu/pool_allocator.cc:247] PoolAllocator: After 2858 get requests, put_count=2796 evicted_count=1000 eviction_rate=0.357654 and unsatisfied allocation rate=0.406578
I tensorflow/core/common_runtime/gpu/pool_allocator.cc:259] Raising pool_size_limit_ from 100 to 110
I tensorflow/core/common_runtime/gpu/pool_allocator.cc:247] PoolAllocator: After 2666580 get requests, put_count=2666580 evicted_count=3000 eviction_rate=0.00112504 and unsatisfied allocation rate=0.00113216
/usr/local/lib/python3.6/site-packages/sklearn/preprocessing/label.py:151: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use array.size > 0 to check that an array is not empty.
if diff:
/usr/local/lib/python3.6/site-packages/sklearn/preprocessing/label.py:151: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use array.size > 0 to check that an array is not empty.
if diff:
/usr/local/lib/python3.6/site-packages/sklearn/preprocessing/label.py:151: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use array.size > 0 to check that an array is not empty.
if diff:
/usr/local/lib/python3.6/site-packages/sklearn/preprocessing/label.py:151: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use array.size > 0 to check that an array is not empty.
if diff:
/usr/local/lib/python3.6/site-packages/sklearn/preprocessing/label.py:151: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use array.size > 0 to check that an array is not empty.
if diff:
/usr/local/lib/python3.6/site-packages/sklearn/preprocessing/label.py:151: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use array.size > 0 to check that an array is not empty.
if diff:
/usr/local/lib/python3.6/site-packages/sklearn/preprocessing/label.py:151: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use array.size > 0 to check that an array is not empty.
if diff:
/usr/local/lib/python3.6/site-packages/sklearn/preprocessing/label.py:151: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use array.size > 0 to check that an array is not empty.
if diff:
/usr/local/lib/python3.6/site-packages/sklearn/preprocessing/label.py:151: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use array.size > 0 to check that an array is not empty.
if diff:
/usr/local/lib/python3.6/site-packages/sklearn/preprocessing/label.py:151: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use array.size > 0 to check that an array is not empty.
if diff:
/usr/local/lib/python3.6/site-packages/sklearn/preprocessing/label.py:151: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use array.size > 0 to check that an array is not empty.
if diff:
/usr/local/lib/python3.6/site-packages/sklearn/preprocessing/label.py:151: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use array.size > 0 to check that an array is not empty.
if diff:
/usr/local/lib/python3.6/site-packages/sklearn/preprocessing/label.py:151: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use array.size > 0 to check that an array is not empty.
if diff:
/usr/local/lib/python3.6/site-packages/sklearn/preprocessing/label.py:151: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use array.size > 0 to check that an array is not empty.
if diff:
/usr/local/lib/python3.6/site-packages/sklearn/preprocessing/label.py:151: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use array.size > 0 to check that an array is not empty.
if diff:
/usr/local/lib/python3.6/site-packages/sklearn/preprocessing/label.py:151: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use array.size > 0 to check that an array is not empty.
if diff:
miccai2018.py:253: FutureWarning: Method .as_matrix will be removed in a future version. Use .values instead.
matrix_f = confusion_matrix_f.as_matrix()
train size:23
val size:8
test size:8

It depends on the GPU I guess.

Make sure to change the max_iter to 1 if you do not want to average over 40 runs here

In general on our GTX 1080, it takes one day to finish one iteration over the three surgical tasks.

Hello @Hosseinhashemiir

Did you manage to reproduce the results with you current settings ?

Glad to help in any way I can.