oist / Usiigaci

Usiigaci: stain-free cell tracking in phase contrast microscopy enabled by supervised machine learning
MIT License
192 stars 68 forks source link

Tensoflow2 compactable #24

Open Karobben opened 2 years ago

Karobben commented 2 years ago

Since pip can't install tensoflow==1.7.0 now, we can only install tensoflow>=2.0 You may get the error:

ERROR: Could not find a version that satisfies the requirement tensorflow==1.70 (from versions: 2.2.0rc1,

As a result, you may come to some compatibility problems. For example:

AttributeError: module 'tensorflow' has no attribute 'log'
AttributeError: module 'tensorflow' has no attribute 'placeholder'

For solving the problems like this, you should target to the script which causes the problem and change the import tensorflow as tf to import tensorflow.compat.v1 as tf. Cite:dariemihai95

This works fine for me.

hftsai commented 2 years ago

Thank you!

Karobben commented 2 years ago

Thank you!

I am currently running the demo video (T98G_sample.avi ) from the ExampleData directory. It is processing but very slow. Each round takes about 15min on my laptop. So, I run this demo on Server.

Its output looks like this:

2021-12-05 09:15:05.115952: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1186]      0 1 
2021-12-05 09:15:05.115991: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1199] 0:   N Y 
2021-12-05 09:15:05.116022: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1199] 1:   Y N 
100%|██████████| 37/37 [01:39<00:00,  2.70s/it]
100%|██████████| 37/37 [01:49<00:00,  2.97s/it]
100%|██████████| 37/37 [01:35<00:00,  2.57s/it]
100%|██████████| 37/37 [01:46<00:00,  2.89s/it]
100%|██████████| 37/37 [01:40<00:00,  2.72s/it]
100%|██████████| 37/37 [02:11<00:00,  3.56s/it]
100%|██████████| 37/37 [01:32<00:00,  2.50s/it]
100%|██████████| 37/37 [01:41<00:00,  2.74s/it]
100%|██████████| 37/37 [01:40<00:00,  2.71s/it]
100%|██████████| 37/37 [02:07<00:00,  3.44s/it]
100%|██████████| 37/37 [01:32<00:00,  2.50s/it]
100%|██████████| 37/37 [01:39<00:00,  2.69s/it]
100%|██████████| 37/37 [01:39<00:00,  2.70s/it]
100%|██████████| 37/37 [01:58<00:00,  3.20s/it]
100%|██████████| 37/37 [01:32<00:00,  2.51s/it]
100%|██████████| 37/37 [01:43<00:00,  2.81s/it]
100%|██████████| 37/37 [01:42<00:00,  2.76s/it]
100%|██████████| 37/37 [02:09<00:00,  3.51s/it]

Is this normal? Why there are so many processing bars? And about 2mins for each processing? What does this bar mean? Does each progressing bar mean a frame? Does this mean each frame takes about 2mins to process? How long does it take for this demo data processing to be normal?

Thanks

hftsai commented 2 years ago

the processing bar is from the tqdm we use. it is fine when executing on terminal. but often when using notebook-like system it will do that. It's just a bit annoying. each bar indeed means a frame. but it means 2 minute 9 second for processing all 37 images. (each average 3.51s per frame)

It is abit slow but maybe dependent on how many cores on the server you got or from the compatibility performance from tensorflow2 ( ididn't know how to get it to work)

on our original linux system with GTX 1070, each frame takes about 1.2s

Karobben commented 2 years ago

SyntaxError: Non-ASCII character '\xe2' in file cell_main.py on line 20, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

- # Pyqtgraph's ImageView does not emit “time changed” signal
+ # Pyqtgraph's ImageView does not emit "time changed" signal
  File "/mnt/8A26661926660713/Github/Usiigaci/Usiigaci/Tracker/cell_io.py", line 15, in read_img_sequence
    pims_sequence = pims.ImageSequence(join(path, '*.{}'.format(file_extension)), process_func=None)
TypeError: __init__() got an unexpected keyword argument 'process_func'

I used the latest version of pims(0.5), seems the latest process_func is not working. So, just deleted it.

- pims_sequence = pims.ImageSequence(join(path, '*.{}'.format(file_extension)), process_func=None)
+ pims_sequence = pims.ImageSequence(join(path, '*.{}'.format(file_extension)))

Thank you, I finally figured out how everything works. It is a very interesting and robust project. I think maybe you could prepare an easily understandable example sample data file and a clear "quick start" instruction. But of course, this is the best tutorial among cell segmentation and tracking repository in Github!!!

Love this project!!! Thank you, guys!

hftsai commented 2 years ago

Yes please check the requirements.txt.

The old tracker only works with pimps==0.4 relatively it's a easy fix.

We are working a new version not based on matterport's mask rcnn but in pytorch. but it's licensing to a new SaaS product.