zhengyushan / kat Goto Github PK
View Code? Open in Web Editor NEWThe code for Kernel attention transformer (KAT)
License: MIT License
The code for Kernel attention transformer (KAT)
License: MIT License
def extract_tile(image_dir, tile_size, x, y, width, height):
x_start_tile = x // tile_size
y_start_tile = y // tile_size
x_end_tile = (x + width) // tile_size
y_end_tile = (y + height) // tile_size
tmp_image = np.ones(
((y_end_tile - y_start_tile + 1) * tile_size, (x_end_tile - x_start_tile + 1) * tile_size, 3),
np.uint8) * 240
for y_id, col in enumerate(range(x_start_tile, x_end_tile + 1)):
for x_id, row in enumerate(range(y_start_tile, y_end_tile + 1)):
img_path = os.path.join(image_dir, '{:04d}_{:04d}.jpg'.format(row, col))
if not os.path.exists(img_path):
continue
img = cv2.imread(img_path)
h, w, _ = img.shape
tmp_image[(x_id * tile_size):(x_id * tile_size + h), (y_id * tile_size):(y_id * tile_size + w), :] = img
x_off = x % tile_size
y_off = y % tile_size
output = tmp_image[y_off:y_off + height, x_off:x_off + width]
return output
what's the meaning of 'pos[1] * step' in the below function? why you regard it as x and pass it to function extract_file?
def extract_and_save_tiles(image_dir, slide_save_dir, position_list, tile_size,
imsize, step, invert_rgb=False):
for pos in position_list:
img = extract_tile(image_dir, tile_size, pos[1] * step, pos[0] * step,
imsize, imsize)
if len(img) > 0:
if invert_rgb:
img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
cv2.imwrite(
os.path.join(slide_save_dir, '{:04d}_{:04d}.jpg'.format(pos[1], pos[0])), img)
When I run 'cnn_sample', the majority of the 500 patches extracted from each Whole Slide Image (WSI) are blank. Is there an issue with this?
Hello,
very impressed with your work.
But I have a few small questions about Table1 and Table2, specifically about the model FLOP, GPU memory cost, and speed.
As far as I know, the size of each slide is different, which causes the efficiency of each image calculation to be different.
So my question is, what size slice are you computing on, and how many patches are there?
Looking forward to your reply.
Yours.
pzSuen.
How can I get the structure of the whole slide image dataset as you prove. Now i have the part of datasets of TCGA, and they are in the format of SVS. How i can get this photo of each patches. Thanks
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.