小编zey*_*ger的帖子

如何跳过气流操作员中的任务?

Airflow 有没有办法从 PythonOperator 跳过当前任务?例如:

def execute():
    if condition:
        skip_current_task()

task = PythonOperator(task_id='task', python_callable=execute, dag=some_dag)
Run Code Online (Sandbox Code Playgroud)

并且还在 Airflow UI 中将任务标记为“已跳过”?

python airflow airflow-scheduler airflow-operator

7
推荐指数
1
解决办法
3074
查看次数

调整图像大小时出错:“错误:(-215:声明失败)函数'resize'中的func!= 0”

我正在尝试通过将图像数据集重新缩放为(10,10)来预处理numpy数组中的形状为(28,28)的图像。我为此写了一个函数:

def resize_dataset(images):
    resized_images = []
    for img in images:
            img = img.reshape((28,28))
            resized_img = cv2.resize(img, dsize=(10, 10))
            resized_images.append(resized_img)
    return numpy.array(resized_images)
Run Code Online (Sandbox Code Playgroud)

但是,当我实际尝试重新调整它们的大小时,在出现以下错误cv2.resize

error: OpenCV(4.0.0) /io/opencv/modules/imgproc/src/resize.cpp:3662: error: (-215:Assertion failed) func != 0 in function 'resize'
Run Code Online (Sandbox Code Playgroud)

在google中,我只发现在用c ++编写东西时犯同样错误的人做的事情非常不同,例如这样:调整图像大小并更改其深度,这是:http : //answers.opencv.org/question/19715/error-215- func-0-in-function-convertto /

那么,如何解决呢?

python cv2 image-preprocessing

4
推荐指数
2
解决办法
1926
查看次数