dr.elephant 环境搭建及使用详解

Dr.elephant是一款对Hadoop和Spark任务进行性能监控和调优的工具,它由LinkedIn的团队于2016年开源,开源之前已经在公司运行使用2年。

目前使用Dr.elephant的公司国内的有Didi,国外的有airbnb、inmobi、hulu、FourSquare和PayPal等等。 
项目地址:https://github.com/linkedin/dr-elephant

笔者所在公司每天有上万作业提交yarn执行,如果能提高作业性能,这对提升集群资源利用率,减少硬件投入成本有很大意义。

转载地址:dr.elephant 环境搭建及使用详解

编译时注意以下:

    1、dr-elephant/project/Dependencies.scala 修改

            lazy val jacksonVersion = "2.5.4" 

            "com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.5.3",

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Mask R-CNN 是一种用于目标检测和实例分割的深度学习模型。在 Python 中使用 Mask R-CNN,需要先搭建环境,然后安装必要的库,最后编写代码。 以下是使用 Python 编写 Mask R-CNN 实例的步骤: 1. 安装 Anaconda 首先需要安装 Anaconda,Anaconda 是一个流行的 Python 数据科学平台,可以方便地安装和管理 Python 包和依赖项。官网链接:https://www.anaconda.com/products/individual 2. 创建虚拟环境 在 Anaconda 中创建一个虚拟环境,以便在其中安装所需的库和依赖项。在 Anaconda Prompt 或终端中运行以下命令: ```bash conda create --name maskrcnn python=3.6 ``` 这将创建一个名为 maskrcnn 的虚拟环境,并使用 Python 3.6。 3. 激活虚拟环境 在创建虚拟环境后,需要激活它。在 Anaconda Prompt 或终端中运行以下命令: ```bash conda activate maskrcnn ``` 4. 安装必要的库 在激活虚拟环境后,需要安装必要的库和依赖项。以下是需要安装的库: - NumPy - SciPy - Matplotlib - TensorFlow - Keras - Cython - Pillow - scikit-image 可以使用以下命令来安装这些库: ```bash conda install numpy scipy matplotlib tensorflow keras cython pillow scikit-image ``` 5. 克隆 Mask R-CNN 代码 Mask R-CNN 代码存储在 GitHub 上,可以使用以下命令将其克隆到本地: ```bash git clone https://github.com/matterport/Mask_RCNN.git ``` 6. 安装 Mask R-CNN 进入 Mask R-CNN 目录,运行以下命令来安装 Mask R-CNN: ```bash cd Mask_RCNN python setup.py install ``` 7. 下载预训练权重 在使用 Mask R-CNN 进行目标检测或实例分割之前,需要下载预训练权重。可以在以下链接中找到预训练权重:https://github.com/matterport/Mask_RCNN/releases 下载预训练权重后,将其放入 Mask R-CNN 目录中。 现在,环境已经设置好了,可以开始编写代码。以下是一个简单的 Mask R-CNN 实例: ```python import os import sys import random import math import numpy as np import skimage.io import matplotlib import matplotlib.pyplot as plt # Root directory of the project ROOT_DIR = os.path.abspath("./Mask_RCNN") # Import Mask RCNN sys.path.append(ROOT_DIR) from mrcnn import utils import mrcnn.model as modellib from mrcnn import visualize # Import COCO config sys.path.append(os.path.join(ROOT_DIR, "samples/coco/")) # To find local version import coco # Directory to save logs and trained model MODEL_DIR = os.path.join(ROOT_DIR, "logs") # Local path to trained weights file COCO_MODEL_PATH = os.path.join(ROOT_DIR, "mask_rcnn_coco.h5") # Download COCO trained weights from Releases if needed if not os.path.exists(COCO_MODEL_PATH): utils.download_trained_weights(COCO_MODEL_PATH) # Directory of images to run detection on IMAGE_DIR = os.path.abspath("./images") class InferenceConfig(coco.CocoConfig): # Set batch size to 1 since we'll be running inference on # one image at a time. Batch size = GPU_COUNT * IMAGES_PER_GPU GPU_COUNT = 1 IMAGES_PER_GPU = 1 config = InferenceConfig() config.display() # Create model object in inference mode. model = modellib.MaskRCNN(mode="inference", model_dir=MODEL_DIR, config=config) # Load weights trained on MS-COCO model.load_weights(COCO_MODEL_PATH, by_name=True) # COCO Class names # Index of the class in the list is its ID. For example, to get ID of # the teddy bear class, use: class_names.index('teddy bear') class_names = ['BG', 'person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic light', 'fire hydrant', 'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow', 'elephant', 'bear', 'zebra', 'giraffe', 'backpack', 'umbrella', 'handbag', 'tie', 'suitcase', 'frisbee', 'skis', 'snowboard', 'sports ball', 'kite', 'baseball bat', 'baseball glove', 'skateboard', 'surfboard', 'tennis racket', 'bottle', 'wine glass', 'cup', 'fork', 'knife', 'spoon', 'bowl', 'banana', 'apple', 'sandwich', 'orange', 'broccoli', 'carrot', 'hot dog', 'pizza', 'donut', 'cake', 'chair', 'couch', 'potted plant', 'bed', 'dining table', 'toilet', 'tv', 'laptop', 'mouse', 'remote', 'keyboard', 'cell phone', 'microwave', 'oven', 'toaster', 'sink', 'refrigerator', 'book', 'clock', 'vase', 'scissors', 'teddy bear', 'hair drier', 'toothbrush'] # Load a random image from the images folder file_names = next(os.walk(IMAGE_DIR))[2] image = skimage.io.imread(os.path.join(IMAGE_DIR, random.choice(file_names))) # Run detection results = model.detect([image], verbose=1) # Visualize results r = results[0] visualize.display_instances(image, r['rois'], r['masks'], r['class_ids'], class_names, r['scores']) ``` 以上代码使用了 Mask R-CNN 模型对一张随机图片进行目标检测,并使用可视化工具显示结果。在运行代码前,需要将图片放入 IMAGES_DIR 目录中。 可以根据需要修改代码中的参数和配置,以适应不同的需求。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值