diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..ddf576f5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +# Start from Nvidia PyTorch image https://ngc.nvidia.com/catalog/containers/nvidia:pytorch +FROM nvcr.io/nvidia/pytorch:19.07-py3 + +# Install dependencies +RUN pip3 install -U -r requirements.txt + +# Move file into container +# RUN mv 1047.tif ./1047.tif + +# Move model into container +# RUN mv yolov3-spp.pt ./weights + + +# --------------------------------------------------- Extras Below --------------------------------------------------- + +# Build container +# sudo docker image prune -a && sudo docker build -t friendlyhello . && sudo docker tag friendlyhello ultralytics/yolov3:v0 + +# Run container +# time sudo docker run -it --memory=8g --cpus=4 ultralytics/yolov3:v0 bash -c './run.sh /1047.tif /tmp && cat /tmp/1047.tif.txt' + +# Push container to https://hub.docker.com/u/ultralytics +# sudo docker push ultralytics/xview:v30 \ No newline at end of file diff --git a/utils/utils.py b/utils/utils.py index c89b3d03..93653786 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -291,7 +291,7 @@ def wh_iou(box1, box2): class FocalLoss(nn.Module): # Wraps focal loss around existing loss_fcn() https://arxiv.org/pdf/1708.02002.pdf # i.e. criteria = FocalLoss(nn.BCEWithLogitsLoss(), gamma=2.5) - def __init__(self, loss_fcn, alpha=1, gamma=2, reduction='mean'): + def __init__(self, loss_fcn, alpha=1, gamma=0.5, reduction='mean'): super(FocalLoss, self).__init__() loss_fcn.reduction = 'none' # required to apply FL to each element self.loss_fcn = loss_fcn