Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escaping: Escape characters +-&|!(){}[]^"~*?:\ with \, e.g. \+
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Answered
Hey Guys! I'M Trying To Retrieve A Tile Of An Image (

Hey guys! I'm trying to retrieve a tile of an image ( ndarray ) in my pipeline with:
my_tile = image[ tile[0]:tile[1], tile[2]:tile[3], ]But the pipeline replaces this line with:
my_tile = image[(tile[0]:tile[1], tile[2]:tile[3])]Which adds parentheses and causes a syntax error. Is there any way of avoiding these parentheses?

  
  
Posted 2 years ago
Votes Newest

Answers 8


Yeah, I understand that it's a bit confusing what I'm asking. Here's a sample code:
` from clearml.automation.controller import PipelineDecorator

@PipelineDecorator.component(cache=True)
def step_one():
import numpy as np

image = np.ones((100, 100, 3))
crop = image[0:50, 0:50]
print("here's my crop of shape:", crop.shape)

@PipelineDecorator.pipeline(name='custom pipeline logic', project='examples', version='0.0.5')
def executing_pipeline():
step_one()

if name == 'main':
PipelineDecorator.run_locally()
executing_pipeline() `

  
  
Posted 2 years ago

Hi SmugSnake6 , can you add a small snippet to reproduce?

  
  
Posted 2 years ago

Sure, I will do that

  
  
Posted 2 years ago

Thanks 🙂

  
  
Posted 2 years ago

So this seems like it could work as a work-around:
` Python 3.10.6 (main, Aug 10 2022, 11:40:04) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

import numpy as np
a = np.ones((100, 100, 3))
a.take(range(40), 0).take(range(40), 1).shape
(40, 40, 3)

replaces a[0:40, 0:40] `

  
  
Posted 2 years ago

This crashes with:
File "/tmp/tmpa5l_cvuv.py", line 8 crop = image[(0:50, 0:50)] ^ SyntaxError: invalid syntax

  
  
Posted 2 years ago

Also, I'm not sure I understand exactly what you're expecting to get and what you're getting

  
  
Posted 2 years ago

This however works fine:
` Python 3.10.6 (main, Aug 10 2022, 11:40:04) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

import numpy as np
a = np.ones((100, 100, 3))
a[0:50, 0:50].shape
(50, 50, 3)
`

  
  
Posted 2 years ago
1K Views
8 Answers
2 years ago
one year ago
Tags